MySQL Service failed to start-problem handling

Source: Internet
Author: User

  

Symptom: The previous day in MySQL deleted a few unused databases after logging in MySQL the following error occurred: Mysql-u root-ppasswd Error 2002 (HY000): Can ' t connect to local mysql server th Rough socket '/var/run/mysqld/mysqld.sock ' view/var/run/mysqld/mysqld.sock There's no such file. There are several reasons why Mysqld.sock does not exist: 1. Mysql-server2 is not installed. If Mysql-server is installed and it is already running, you will need to check the configuration file to see the answer to the Stack Overflow:/http stackoverflow.com/questions/11657829/ Error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-var-run at this time I found that although Mysql-server has been installed, but Ps-aux | grep ' MySQL ' found that the MySQL service was not turned on; however: sudo service MySQL start error: Start:job failed to start and/var/log/mysql/error.log is empty, cannot be based on day A method that looks like re-security Mysql-server but also saves the original database data on the stack overflow: http://stackoverflow.com/questions/22909060/ Mysql-job-failed-to-start approximate steps: 1. Back up the original database data file in case there is no successful installation:
sudo mkdir/home/<your username>/mysql/cd/var/lib/mysql/sudo cp */home/<your username>/mysql/-R
2. Clean up MySQL for reinstallation
sudo apt-get purge mysql-server-5.1 Mysql-common
3. Delete the/etc/mysql folder and its contents
sudo rm/etc/mysql/-R
4. Check that the original database file is still in/var/lib/mysql/if it does not exist copy the file saved in the first step to this file and change its owner and group to root;
sudo mkdir/var/lib/mysql/sudo chown root:root/var/lib/mysql/-rcd ~/mysql/sudo CP */var/lib/mysql/-R
5. Install the new MySQL server
sudo apt-get install Mysql-server
6. Reconnect to see if the original data exists
Mysql-u root-ppasswdmysql> Show Databases    , +--------------------+| Database           |+--------------------+| information_schema | | mysql              | | performance_schema | | SQL                |+----------- ---------+4 rows in Set (0.00 sec)
At this point, my MySQL back to the original state;

MySQL Service failed to start-problem handling

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.