Troubleshooting notes for MySQL startup

Source: Internet
Author: User

 

When MySQL was started yesterday, it was not very normal. I had to restart it several times. However, I was not concerned about it when it was able to be started. Today, the test and test encountered a problem. MySQL started normally but could not be closed:

 

[Root @ rac2 MySQL] # service MySQL stop

MySQL Server PID file cocould not befound! [Failed]

[Root @ rac2 MySQL] #./MySQL. server stop

MySQL Server PID file cocould not befound! [Failed]

 

The PID file prompted here refers to:/var/lib/MySQL/rac2.pid, this file and/var/lib/MySQL. the sock file is the same and only exists at MySQL runtime. Subsequent verification is as follows:

 

[Root @ rac2 lib] # ls/var/lib/MySQL/rac2.pid

/Var/lib/MySQL/rac2.pid

[Root @ rac2 lib] # service MySQL stop

Shutting down mysql. [OK]

[Root @ rac2 lib] # ls/var/lib/MySQL/rac2.pid

Ls:/var/lib/MySQL/rac2.pid: no such fileor directory

 

So when my MySQL runs normally, this file should exist. One Google saying is my. the basedir parameter in the CNF parameter file is incorrect. Just comment out this parameter, but I have not set this parameter, so it should be irrelevant.

 

Check the default value:

Mysql> show variables like '% basedir % ';

+ --------------- + ------- +

| Variable_name | value |

+ --------------- + ------- +

| Basedir |/usr |

+ --------------- + ------- +

1 row in SET (0.00 Sec)

 

[Root @ rac2 ~] # Ps-Ef | grep MySQL

Root 2161 1 0 09:38? 00:00:00/bin/sh/usr/bin/mysqld_safe -- datadir =/var/lib/MySQL -- PID-file =/var/lib/MySQL/rac2.pid

MySQL 2418 2161 0? 00:00:00/usr/sbin/mysqld -- basedir =/usr -- datadir =/var/lib/MySQL -- Plugin-Dir =/usr/lib64/MySQL/plugin -- user = MySQL -- log -Error =/var/lib/MySQL/rac2.err -- PID-file =/var/lib/MySQL/rac2.pid -- socket =/var/lib/MySQL. sock -- Ports = 3306

Root 3628 3596 0 00:00:00 pts/1 grep MySQL

-- Log information

[Root @ rac2 ~] # Cat/var/lib/MySQL/rac2.err

111129 9:38:49 [note] plugin 'federated 'is disabled.

111129 9:38:49 InnoDB: the InnoDB memory heap is disabled

111129 9:38:49 InnoDB: mutexes and rw_locks use GCC atomic builtins

111129 9:38:49 InnoDB: Compressed tables use zlib 1.2.3

111129 9:38:49 InnoDB: Using Linux native AIO

111129 9:38:49 InnoDB: initializing buffer pool, size = 128.0 m

111129 9:38:50 InnoDB: Completed initialization of Buffer Pool

111129 9:38:50 InnoDB: highest supported file format is barracuda.

111129 9:38:50 InnoDB: Waiting For thebackground threads to start

111129 9:38:51 InnoDB: 1.1.8 started; log sequence number 1605950

111129 9:38:52 [note] event schedents: loaded 0 events

111129 9:38:52 [note]/usr/sbin/mysqld: Ready for connections.

Version: '5. 5.15-log' socket: '/var/lib/MySQL. Sock' port: 3306 MySQL Community Server (GPL)

111129 10:50:36 mysqld_safe starting mysqlddaemon with databases from/var/lib/MySQL

111129 10:50:37 [note] plugin 'federated 'is disabled.

111129 10:50:37 InnoDB: the InnoDB memoryheap is disabled

111129 10:50:37 InnoDB: mutexes andrw_locks use GCC atomic builtins

111129 10:50:37 InnoDB: Compressed tablesuse zlib 1.2.3

111129 10:50:37 InnoDB: Using Linux nativeaio

111129 10:50:37 InnoDB: initializing bufferpool, size = 128.0 m

111129 10:50:37 InnoDB: completedinitialization of Buffer Pool

InnoDB: Unable to lock./ibdata1, error: 11

InnoDB: Check that you do not already haveanother mysqld Process

InnoDB: using the same InnoDB data or logfiles.

111129 10:50:37 InnoDB: retrying to lock the first data file

InnoDB: Unable to lock./ibdata1, error: 11

InnoDB: Check that you do not already haveanother mysqld Process

InnoDB: using the same InnoDB data or logfiles.

...

InnoDB: Check that you do not already haveanother mysqld Process

InnoDB: using the same InnoDB data or logfiles.

InnoDB: Unable to lock./ibdata1, error: 11

InnoDB: Check that you do not already haveanother mysqld Process

-- This prompt indicates that multiple mysqld processes are running.

 

 

Solution:

(1) re-use: PS-Ef | grep MySQL to query all processes and kill all processes,

(2) re-assign permissions to related directories

[Root @ rac2/] # chown mysql. mysql-r/var/lib/MySQL /*

[Root @ rac2/] # chmod 755-r/var/lib/MySQL /*

 

-- Restart successful:

[Root @ rac2/] # service MySQL start

Starting MySQL... [OK]

[Root @ rac2/] # ps-Ef | grep MySQL

Root 27936 1 1 00:00:00 pts/1/bin/sh/usr/bin/mysqld_safe -- datadir =/var/lib/MySQL -- PID-file =/var/lib/MySQL/ rac2.pid

MySQL 28193 27936 3 00:00:00 pts/1/usr/sbin/mysqld -- basedir =/usr -- datadir =/var/lib/MySQL -- Plugin-Dir =/usr/lib64/MySQL /plugin -- user = MySQL -- log-error =/var/lib/MySQL/rac2.err -- PID-file =/var/lib/MySQL/rac2.pid -- socket =/var/lib/ mySQL/MySQL. sock -- Ports = 3306

Root 28220 3596 0 00:00:00 pts/1 grep MySQL

[Root @ rac2/] # ll/var/lib/MySQL. Sock

Srwxrwxrwx 1 MySQL 0 Nov 29 14:08/var/lib/MySQL. Sock

 

View the log again:

[Root @ rac2 lib] # tail-20/var/lib/MySQL/rac2.err

111129 14:51:53 [note] event schedents: purging the queue. 0 events

111129 14:51:53 InnoDB: Starting shutdown...

111129 14:51:54 InnoDB: shutdown completed; log sequencenumber 1605950

111129 14:51:54 [note]/usr/sbin/mysqld: shutdown complete

 

111129 14:51:54 mysqld_safe mysqld from pidfile/var/lib/MySQL/rac2.pid ended

111129 14:53:34 mysqld_safe starting mysqlddaemon with databases from/var/lib/MySQL

111129 14:53:34 [note] plugin 'federated 'is disabled.

111129 14:53:34 InnoDB: the InnoDB memoryheap is disabled

111129 14:53:34 InnoDB: mutexes andrw_locks use GCC atomic builtins

111129 14:53:34 InnoDB: Compressed tablesuse zlib 1.2.3

111129 14:53:34 InnoDB: Using Linux nativeaio

111129 14:53:34 InnoDB: initializing bufferpool, size = 128.0 m

111129 14:53:34 InnoDB: Completed initializationof Buffer Pool

111129 14:53:35 InnoDB: highest supportedfile format is barracuda.

111129 14:53:35 InnoDB: 1.1.8 started; log sequence number 1605950

111129 14:53:35 [Warning] Neither -- relay-log nor -- relay-log-index were used; so replication may break when thismysql server acts as a slave and has his hostname changed !! Please use '-- relay-log = rac2-relay-bin' to avoid this problem.

111129 14:53:35 [note] event schedents: loaded 0 events

111129 14:53:35 [note]/usr/sbin/mysqld: Ready for connections.

Version: '5. 5.15-log' socket: '/var/lib/MySQL. Sock' port: 3306 MySQL Community Server (GPL)

[Root @ rac2 lib] #

 

 

Note:

Because there is no relevant information retained before, after modification, although the simulation is repeated multiple times, the current fault cannot be restored, and all lack of sufficient first-hand information to prove this problem. However, you can try either of the following two methods:

MySQL Server PID file cocould not befound!

-- May be caused by permission issues with related directories.

 

Check that you do not already have anothermysqld Process

-- This error is caused by a duplicate process. You can first PS and then kill the relevant process and try again.

 

 

 

 

Bytes -------------------------------------------------------------------------------------------------------

All rights reserved. reprinted articles are allowed, but source addresses must be indicated by links. Otherwise, the documents will be held legally responsible!

Blog: http://blog.csdn.net/tianlesoftware

WEAVER: http://weibo.com/tianlesoftware

Email: tianlesoftware@gmail.com

Skype: tianlesoftware

 

------- Add a group to describe the relationship between Oracle tablespace and data files in the remarks section. Otherwise, reject the application ----

Dba1 group: 62697716 (full); dba2 group: 62697977 (full) dba3 group: 62697850 (full)

Super DBA group: 63306533 (full); dba4 group: 83829929 dba5 group: 142216823

Dba6 group: 158654907 dba7 group: 172855474 dba8 group: 102954821

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.