如何修复 java.sql.SQLException: Server is running in --secure-auth mode, but 'user'@'host' has a password in old format; (……)?

Ric*_*rdo 5 java mysql upgrade password-encryption

将 MySQL 5.1 升级到 5.6 后,尝试启动 JBoss 失败,出现以下异常:

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
Run Code Online (Sandbox Code Playgroud)

如何解决这个问题?

Ric*_*rdo 3

此问题已通过以下方式修复:

1)更新'user'用户的密码哈希值

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

2)停止“mysql”服务器

/etc/init.d/mysql stop

3)old_passwords=1/etc/my.cnf文件上设置标志

4)启动“mysql”服务器

/etc/init.d/mysql start

另请参阅文档:MySQL 密码哈希