Centos6.5 X64,Mysql 5.6.20 X64 均是64位


顺便记录一下,方便后来人。


1、java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)


确认用户名、密码是正确的。


select * from mysql.user;之后,发现 没有localhost用户

可以复制一行 127.0.0.1的记录,然后再次修改密码

mysql> UPDATE user SET Password=PASSWORD('123456') where USER='root';
mysql> FLUSH PRIVILEGES;


2、改了之后,会出现如下异常

java.sql.SQLException: Your password has expired. To log in you must change it using a client that supports expired passwords.


select host,user,password_expired from mysql.user;


将password_expired  改为N即可