Solution to failure of MySQL startup in Ubuntu
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.