Objective
Yesterday is a day to start MySQL prompts: The server quit without updating PID file
, today after the installation of MySQL or the same error, and then recovered a /usr/my.cnf
bit suddenly can start. (Obviously yesterday/usr/my.cnf is the default, there is a solution to change this file only to change)
Then there is no problem to set the root password, search a few methods can not, until you see the following method of a line.
Workaround One:
#/etc/init.d/mysql Stop
# mysqld_safe--user=mysql--skip-grant-tables--skip-networking &
# mysql-u root m Ysql
mysql> UPDATE user SET Password=password (' NewPassword ') where user= ' root ';
mysql> FLUSH privileges;
Mysql> quit
#/etc/init.d/mysql Restart
# mysql-uroot-p
Enter Password: < Enter the new password newpassword>
Workaround Two:
Use directly /etc/mysql/debian.cnf
[client]
the user name and password provided in the section of the file:
# mysql-udebian-sys-maint-p
Enter Password: < Enter the password >
mysql> UPDATE user SET password= of the [client] section PASSWORD (' NewPassword ') where user= ' root ';
mysql> FLUSH privileges;
Mysql> quit
# mysql-uroot-p
Enter Password: < Enter the new password newpassword>
Summarize
The above is the entire content of this article, I hope the content of this article for everyone's study or work can help, if there is doubt you can message exchange.