Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Note: This article from "Punk" blog, if you want to reprint this article, please contact the author! and annotated Source: http://blog.csdn.net/faye0412/article/details/7038290
Cause of the problem:
Do one thing today: I copy a database data file (/var/lib/mysql entire folder) on the VM to another VM, and then start MySQL on the new VM, the result is 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).
As a result, most of Google's answers are:
1. Note that the skip-federated annotation in/etc/my.cnf is #skip-federated;
2. my.cnf file configuration is too high, redefine the parameters (as defined by the server);
3. Kill the Mysql_safe and mysqld processes 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 database S 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 complete111203 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]# lltotal 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.localdom Ain.errdrwx--x--x. 2 mysql mysql 4096 Dec 3 17:55 mysql-rw-rw----. 1 mysql mysql 4847020 Dec 3 17:55 mysq L-BIN.000001-RW-RW----. 1 mysql mysql 1373 Dec 3 17:56 mysql-bin.000002-rw-r--r--. 1 root root 19 Dec 3 15:38 mysql-bin.indexdrwx------. 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_marke R-lastdrwxr-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 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!!
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. error! The server quit without updating PID file