mysqladmin -u root password 'java-er.com'
# vi /etc/my.cnf
在[mysqld]的段中加上一句:
skip-grant-tables
重启msyql
service mysqld stop
service mysqld start
mysql UPDATE user SET authentication_string=PASSWORD('java-er.com') where USER='root'; alter user 'root'@'localhost' identified by 'java-er.com'; set password=password("java-er.com");
成功以后将my.cnf里skip-grant-tables 注释,或者删除,重启mysql服务就好了。