Mysql-uroot-p
Enter the password.
An error occurred!
ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: YSE)
Leave the password Blank
Or error!
ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: NO)
Change the password!
#/Etc/init. d/mysql stop
# Mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking &
Mysql <----- Logon
Mysql> UPDATE user SET Password = PASSWORD ('newpassword') where USER = 'root'; <---- change the Password
Mysql> flush privileges;
If you forget the password of the root user logging on to mysql
#/Etc/init. d/mysqld stop
Start the database manually
# Mysqld_safe -- skip-grant-tables -- skip-networking &
# Mysql // Login
In this case, you cannot use grant to change the password. You can only use update to change the password)
> Update mysql. user set password = password ('000000') where user = 'root'; // reset the password.
#/Etc/init. d/mysqld restart // restart the database
Skip-grant-tables // skip the authorization table
Skip-networking // skip the network