Mysql:mysql is not running but lock exists workaround _mysql

Source: Internet
Author: User
Error starting MySQL, view the next status, found that the MySQL is not running,but lock exists:

a netizen said May and log file, so the log file to remove, and then restart MySQL finally OK

Looked for the information, basically is to say:

Copy Code code as follows:

# Chown-r Mysql:mysql/var/lib/mysql
# Rm/var/lock/subsys/mysql
# service MySQL Restart


The discovery is still the tip.

Because it is on the cpanel server, the command is also:

Copy Code code as follows:

# yum Remove MySQL Mysql-server


Uninstall MySQL, and then reinstall:

Copy Code code as follows:

#/scripts/mysqlup–force


Installed after the restart or error found, and carefully looked at, found that the PID file is not named after the current host name, and then executed:

Copy Code code as follows:

# echo ' PS aux | grep MySQL | grep "User=mysql" | Grep-v "grep" | awk ' {print $} ' >> Hostname.pid

Regenerated the next PID file, while modifying owner and group for MySQL:

Copy Code code as follows:

# chown Mysql:mysql Hostname.pid


It is still an error to save and restart later.

Finally found a netizen said May and log file, so the log file to remove, and then restart MySQL finally OK.

A MySQL crash on Red Hat system resulted with:

/etc/init.d/mysql status

Coming back with:

MySQL is not running but lock exists


Solved by removing the lock file:

Rm/var/lock/subsys/mysql


If This happens again it may also is necessary to remove the PID file From/var/lib/mysql

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.