MySQL dead but subsys locked may occur for no reason

Source: Internet
Author: User

Problem description:
1. After installing MySQL, use
Service mysqld restart
The stop mysqld service always fails.
2. the/var/lib/MySQL. Sock issue cannot be found when you log on with MySQL-uroot-P.
3. Use Service mysqld status to display MySQL dead but subsys locked
Solution:
Most MySQL instances are installed in RPM mode. It will automatically search for the/var/lib/MySQL. Sock file.
1. First check the location of MySQL. Sock.
Use the socket field in/etc/My. CNF.

If the file "/etc/My. CNF" is not found, the system will prompt "can't connect to local MySQL server through socket"/var/lib/MySQL. Sock "(2 ). The method is to copy the path of my. CNF to the/etc/directory.
If the socket is as follows:

Socket =/tmp/MySQL. Sock

If the mysql. Sock file cannot be found or is lost

Executable

# Mysqld_safe

# MySQL

2. Add a soft connection for MySQL. Sock (equivalent to a shortcut in Windows ). For example, the actual mysql. Sock is under/tmp.
Run the following command.

Ln-S/tmp/MySQL. Sock/var/lib/MySQL. Sock

3. If neither of the preceding methods takes effect. Use
3.1 Service mysqld restart
3.2 service mysqld status
If MySQL dead but subsys locked appears
4. method 1
4.1 Service mysqld stop (Stop Service)
4.2 Rm-fr/var/lib/MySQL/* (delete all files under/var/lib/MySQL)
4.3 RM/var/lock/subsys/mysqld (delete the locked file)
4.4 killall mysqld (killing all mysqld processes)
4.5 service MySQL start (start MySQL Service .)
5. method 2
5.1 view log files
CAT/var/log/mysqld. Log
5.2 Stop Service
Service mysqld stop
5.3 view the MySQL process
PS-Aux | grep-I ^ MySQL
5.4 terminate the process
Killall MySQL
5.5 delete/var/lib/MySQL /*
Rm-RF/var/lib/MySQL /*
5.6 view the global configuration file of MySQL
CAT/ET/My. CNF
5.7 copy the pre-configured options file of the Gregorian server. The priority of the/etc/MySQL global configuration file is higher than that of the server options file, but more options are available here.
CP/usr/share/doc/MySQL-server -?.??.?? /My-small.cnf/var/lib/MySQL
5.8 recreate the initial database
Mysql_install_db
5.9 check and set the service running level.
Chkconfig-level 345 mysqld on
Chkconfig-list mysqld
5.10 start the service
Service mysqld restart
5.11 view log files
CAT/var/log/mysqld. Log
You can use either 4 or 5.

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.