After MySQL is started, an error is reported! Solution to the server quit without updating PID file Error

Source: Internet
Author: User
Tags localhost mysql
Note: This article is from the blog "afei". If you want to repost this article, please contact the author! And indicate the source: http://blog.csdn.net/faye0412/article/details/7038290

Cause:
Today, I did one thing: On the VM, I copied a database data file (/var/lib/MySQL entire folder) to another VM, then start MySQL on the new VM. the following error is returned:
[Root @ localhost MySQL] # service MySQL start
Starting MySQL... error! The server quit without updating PID file (/var/lib/MySQL/localhost. localdomain. PID ).
Most of Google's answers are:
1. Comment out Skip-federated in/etc/My. CNF and remove it: # Skip-federated;
2. The my. CNF file is too configured, and the parameters are redefined (defined based on the server situation );
3. Kill the mysql_safe and mysqld processes and restart them;
4. The current log file is too large and exceeds the size defined in my. CNF (64 MB by default). Delete the log file and restart it;

5. In other cases, view the log file (my name is localhost. localdomain. Err, which varies from person to person) and analyze the log file in detail;

Solution:

Here, I view the log content as follows:

[Root @ localhost 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 checked my directory file, the mysql-bin.index file exists, strange:

[Root @ localhost MySQL] # ll
Total 49828
-RW ----. 1 MySQL 35651584 Dec 3 ibdata1
-RW ----. 1 MySQL 5242880 Dec 3 ib_logfile0
-RW ----. 1 MySQL 5242880 Dec 3 ib_logfile1
-RW ----. 1 MySQL Root 1376 Dec 3 localhost. localdomain. Err
Drwx -- X. 2 MySQL 4096 Dec 3 MySQL
-RW ----. 1 MySQL 4847020 Dec 3 mysql-bin.000001
-RW ----. 1 MySQL 1373 Dec 3 mysql-bin.000002
-RW-r --. 1 Root 19 Dec 3 mysql-bin.index
Drwx ------. 2 MySQL 4096 Dec 3 performance_schema
-RW-r --. 1 Root 116 Nov 25 21:03 rpm_upgrade_history
-RW-r --. 1 MySQL 116 Nov 25 RPM_UPGRADE_MARKER-LAST
Drwxr-XR-X. 2 MySQL 4096 Dec 3 Test

I read it carefully. Why?-RW-r --. 1 Root 19 Dec 3 mysql-bin.index---- Is the permission insufficient? So I added the write permission to the file and restarted the file !!! Oh!

Is it encoding? Is it... continue to guess... Problem still not solved, then I did one thing, will delete the mysql-bin.index file! Restart !! Oh! No !!

[Root @ localhost MySQL] # rm-RF mysql-bin.index.
[Root @ localhost MySQL] #
[Root @ localhost MySQL] # service MySQL start
Starting MySQL... success!

That's it ?? Why? This is still an unsolved mystery (for me). If you have any concerns, please let us know :)

Supplement:

Many times, when we package and copy the database directory to the slave machine during master synchronization, a similar problem may occur during restart. The solution is as follows:

1) grant the MySQL database data directory permission: chown-r MYSQL: MySQL directory name

2) ensure that the MySQL process is disabled;

Note the following: IB _ *, MySQL-bin -*,*. err (Log File) and master-Info and relay-info files can be deleted, which is equivalent to re-initializing the database data, but the premise is:

1) shut down the MySQL process before the operation;

2) After deleting the file, you need to restart mysql. If there is an exception, check the log to find the problem. Generally, it is better to locate and solve the problem.

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.