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

Source: Internet
Author: User
Tags localhost mysql

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

After restarting the server, the following error is reported:

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

After a long struggle, I couldn't find a solution. Then I suddenly thought of modifying the mysql configuration file "/usr/my. cnf"

Previously, the default encoding is configured, and"default-character-set=utf8"


Delete this sentence and start mysql again.


For more information found in solving this problem, add it to your favorites:


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.



Starting MySQLThe server quit without updating PID file (/var/lib/mysql/localhostlocaldomainpid

Problem description: [root @ bogon mysql-5.1.41] #/etc/rc. d/init. d/mysqld startstartstarting MySQL. manager of pid-file quit without updating file. [failed] --------------------------- solution: When configuring, there is a step that is cp support-files/my-medium.cnf/etc/my. cnf; edit my. cnf: Add datadir =/usr/local/mysql/data under [mysqld]. For example, # The MySQL server [mysqld] port = 3306 socket =/tmp/mysql. sockskip-lockingkey_buffer_size = 16Mmax_allowed_packet = 1Mtable_open_cache = 64sort_buffer_size = 512Knet_buffer_length = 8Kread_buffer_s...

2. First, go to/usr/local/mysql/data and select chown-R mysql: mysql *. Then, kill the mysql process and start musql.

Open/etc/selinux/config, change SELINUX = enforcing to SELINUX = disabled, and then save the disk and restart the machine.

4. It is true that the my. cnf configuration file is a problem.
/Etc/my. cnf comes from the following files:

If your memory is less than or equal to 64 MB, copy/usr/local/share/mysql/my-small.cnf to/etc/my. cnf
# This is for a system with little memory (<= 64 M) where MySQL is only used
# From time to time and it's important that the mysqld daemon
# Doesn' t use much resources.

If the memory is 128 M, copy/usr/local/share/mysql/my-medium.cnf to/etc/my. cnf
# This is for a system with little memory (32 M-64 M) where MySQL plays
# An important part, or systems up to 128 M where MySQL is used together
# Other programs (such as a web server)

If the memory is 512 M, copy/usr/local/share/mysql/my-large.cnf to/etc/my. cnf
# This is for a large system with memory = 512 M where the system runs mainly
# MyS... the remaining full text>

Mysql startup in linux: The server quit without updating PID file (lib/mysql/solr4pid)

This means that your service is exited, but his pid is not updated, that is, the process is not shut down. Run the command to find the process and Kill it !!!
----------------
Please adopt it !!!

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.