I found that the MySQL database on one of our Ubuntu servers is stuck and may be deadlocked. So I tried to use the servicemysqlrestart command. As a result, MySQL returned the stop/waiting status when stopping, use servicemysqlstatus to check its status. The returned result is & ldquo; mysqlrespawn/post-start & rdquo;. In this case, MySQL cannot be started, and then it cannot be started,
I found that the MySQL database on one of our Ubuntu servers is stuck. It may be a deadlock, so I tried to use the Command service mysql restart, result MySQL returns the stop/waiting status when it is stopped, and uses service mysql status to view its status. The returned result is "mysql respawn/post-start". In this way, MySQL cannot be started, then, I couldn't get up. I searched the internet for more than half an hour and couldn't find a good solution.
Finally, I saw the Ubuntu mysql configuration repair command dpkg-reconfigure mysql-server-5.1, so I tried to use this command to fix it:
Dpkg-reconfigure mysql-server-5.1
I reset the root password on the prompt page. After the configuration, mysql was started miraculously.
In the process of fixing this mysql, I will share with you a little bit about the solution to this problem.
1. After the apt-get install mysql command is used in Ubuntu, we recommend that you use the command dpkg-reconfigure to reset mysql when it cannot be started.
2. After the dpkg-reconfigure method is used to fix mysql, the mysql data user will be lost. Therefore, you have to repair the mysql DATA on your server, you can use the following command to handle the problem:
Grant all privileges on db. * TO user @ localhost identified by "pass ";
In this way, we can restore the users in your original system.
3. In Ubuntu, if the software package is installed in apt-get install mode, run the dpkg-reconfigure command when the software package encounters a problem, you can fix the original software package. In this way, you can bypass many software packages to solve the problem with half the effort.
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2
This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-03/114449.htm