0

I just did a new install on Ubuntu 16.04 and MySQL 5.7. Im able to connect on the command line by my application running in Tomcat is getting access denied for the same user. Here is how I created my user:

create user 'myuser'@'localhost' identified by 'mypassword';
grant all on myschema.* to 'invenio'@'myuser';

I can login from the command line and get access to everything:

 mysql -u myuser -p

But, my application gets access denied for the same user/password

show grants;

| GRANT USAGE ON *.* TO 'myuser'@'localhost'                  |
| GRANT ALL PRIVILEGES ON `myschema`.* TO 'myuser'@'localhost' |

The user privileges look strange:

SELECT * FROM  information_schema.USER_PRIVILEGES;
`myuser'@'localhost'          | def           | USAGE                   | NO

This is the error from Tomcat:

    Access denied for user 'myuser'@'localhost' (using password: YES)
java.sql.SQLException: Access denied for user 'myuser'@'localhost' 
    (using password: YES)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237)

Any lead to what Im missing would be greatly appreciated.

Giacomo1968
  • 58,727

2 Answers2

1

ok.. my fault(well someones fault) the password in the properties file was not what it was suppose to be..

-1

Looks like the problem might be with the DB connection rather than the mysql user, I would make sure that your app is able to properly commnunicate with MySQL. I would also try install phpmyadmin and try to log in with the user you created and see what happens.

cadash
  • 13