Starting MySQL ... The server quit without updating PID file [failed]lib/mysql/localhost.localdomain.pid).

Source: Internet
Author: User

Restart the server, the following error is reported after the start:

Starting MySQL ... The server quit without updating PID file [failed]lib/mysql/localhost.localdomain.pid).

Tangled for a long time did not find a solution, then suddenly thought of modifying the MySQL configuration file "/usr/my.cnf"

Before configuring the default encoding, add the "default -character -set =utf8


Delete this sentence, and then start MySQL just fine.


In the process of solving this problem found the relatively good information, here to collect:

cause of the problem:
did one thing today: I copied a database data file (/var/lib/mysql entire folder) on a VM to another VM, and then started MySQL on the new VM, which reported the following exception:
[[email  Protected] mysql]# service MySQL start
starting MySQL. error! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid).
So Google, most of the answers are:
1. Comment/etc/my.cnf skip-federated comment out #skip-federated;
2. The my.cnf file is configured too high to redefine its parameters (as defined by the server);
3. Kill the Mysql_safe and the mysqld process before restarting;
4. The current log file is too large to exceed the size defined in MY.CNF (default is 64M), delete the log file and restart;

5. Other situation, view the log file (my is localhost.localdomain.err, the specific individual), and then the specific analysis;


Problem solving:

Among them, I looked at the log contents as follows:

[email protected] mysql]# less Localhost.localdomain.err
111203 22:09:03 Mysqld_safe starting mysqld daemon with databases From/var/lib/mysql
^g/usr/sbin/mysqld:file './mysql-bin.index ' not Found (errcode:13)
111203 22:09:03 [ERROR] Aborting

111203 22:09:03 [Note]/usr/sbin/mysqld:shutdown complete

111203 22:09:03 mysqld_safe mysqld from PID File/var/lib/mysql/localhost.localdomain.pid ended


But I looked at my catalog file, the Mysql-bin.index file is there, strange:

[email protected] mysql]# LL
Total 49828
-RW-RW----. 1 mysql mysql 35651584 Dec 3 17:55 ibdata1
-RW-RW----. 1 mysql mysql 5242880 Dec 3 17:55 ib_logfile0
-RW-RW----. 1 mysql mysql 5242880 Dec 3 15:45 ib_logfile1
-RW-RW----. 1 mysql root 1376 Dec 3 22:02 localhost.localdomain.err
Drwx--x--x. 2 mysql mysql 4096 Dec 3 17:55 MySQL
-RW-RW----. 1 mysql mysql 4847020 Dec 3 17:55 mysql-bin.000001
-RW-RW----. 1 MySQL MySQL 1373 Dec 3 17:56 mysql-bin.000002
-rw-r--r--. 1 root root 3 15:38 mysql-bin.index
DRWX------. 2 mysql mysql 4096 Dec 3 17:55 Performance_schema
-rw-r--r--. 1 root root 21:03 rpm_upgrade_history
-rw-r--r--. 1 MySQL MySQL 21:03 rpm_upgrade_marker-last
Drwxr-xr-x. 2 mysql mysql 4096 Dec 3 17:55 test

Take a closer look, eh? -rw-r--r--. 1 root root 3 15:38 mysql-bin.index----Don't you have enough authority? So the file added write permission, restart, Tao sound is still!!! Oh, Oh!


Is it a coding problem? Is it ...? Keep guessing ... The problem is still not solved, then I did a thing, the Mysql-bin.index file deleted! Restart!! Oh! no!!

[Email protected] mysql]# RM-RF Mysql-bin.index
[Email protected] mysql]#
[[Email protected] mysql]# service MySQL start
Starting MySQL ... success!


That's it?? Why is it? So far this is still a mystery (for me), if you have informed people, please inform:)


Add:

Most of the time, we in the master from the time of synchronization, the database directory as a whole package copy to the slave, the restart will often appear similar problems, the solution is still:

1) give MySQL database data directory permissions: Chown-r mysql:mysql directory Name

2) Make sure that the MySQL process is closed;


It is also important to note that ib_*, mysql-bin-*, *.err (log files), and Master-info and relay-info files can be deleted, which is equivalent to re-initializing the database data, but only if:

1) Turn off the MySQL process before you start the operation;

2) Delete the file to restart MySQL, if there is an exception, please check the log to find the problem, generally better location and resolution.


Starting MySQL ... The server quit without updating PID file [failed]lib/mysql/localhost.localdomain.pid).

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.