Search code examples
mysql-connectoraccess-deniedmysqlconnector-j

MySQL Connector/MXJ: authentication issue


I would like to get started with MySQL Connector/MXJ. I am not sure how the authentication works. Where do I specify the actual user/password pair before connecting to mysqld?

I tried the following URL connection to no avail:

jdbc:mysql:mxj://localhost:3336/bignibouTest?server.basedir=/home/julien/tmp&createDatabaseIfNotExist=true&server.initialize-user=true&server.initialize-user-name=root&server.initialize-user-password=root

I systematically get "java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)".

Maybe it if someone could let me know how not to use a password, it would work.


Solution

  • One satisfactory workaround I found it to specify server.initialize-user=false and use:

    • user:"root"
    • password:""

    in other words, MySQL's default password for root seems to be an empty string.

    As far as unit tests are concerned this is OK.