ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:yes)
Solve:
1, first stop the MySQL service, the command is as follows:
#/etc/init.d/mysql stop
2, restart the service, the command is as follows:
#/etc/init.d/mysql Stop
# Mysqld_safe--user=mysql--skip-grant-tables--skip-networking &
3. Log in to MySQL and change Password: command and SQL are as follows:
# mysql-u Root MySQL
mysql> Update user Set Password=password (' New password ') where user= ' root ';
mysql> flush Privileges;
mysql>commit;
mysql>quit;
#/etc/init.d/mysql Stop
#/etc/init.d/mysql Start
4, check whether the MySQL background process started, the command is as follows:
#/etc/init.d/mysql status
#mysql-uroot-p
Enter password:< password for new settings >
5. View data information:
Mysql>show databases;
If you report the following error:
ERROR 1820 (HY000): Must SET PASSWORD before executing this statement
Please execute the following command:
Mysql>set password=password (' New password ');
Re-execution:
Mysql>show databases;
All right, OK!