Search code examples
javamysqlupgradepassword-encryption

How to fix java.sql.SQLException: Server is running in --secure-auth mode, but 'user'@'host' has a password in the old format; (...)?


After upgrading MySQL 5.1 to 5.6, trying to start JBoss failed with this exception:

java.sql.SQLException: 
  Server is running in --secure-auth mode, but 'user'@'localhost' 
  has a password in the old format;  please change the password to the new format

How to fix this issue?


Solution

  • This issue was fixed by:

    1) Update the value of the password hash of the 'user' user

    UPDATE mysql.user set password = PASSWORD('my password text') where user= 'user';

    2) Stop 'mysql' server

    /etc/init.d/mysql stop

    3) Set the flag old_passwords=1 on the /etc/my.cnf file

    4) Start 'mysql' server

    /etc/init.d/mysql start

    See also documentation: MySQL password hashing