MySQL startup troubleshooting NOTE _ MySQL

Source: Internet
Author: User
Note: When MySQL was started before bitsCN.com, it was not very normal. it had to be restarted several times, but it was not important to start it. Today, the test has encountered a problem, mySQL can be started normally, but cannot 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.


Author tianlesoftware
BitsCN.com

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.