MySQL Study之--MySQL启动错误“/var/lib/mysql/mysql.sock”
系统环境:
操作系统: RedHat EL6.4(64)
MySQL: Percona Server 5.6
错误现象:
查看数据库的启动:
[root@localhost ~]# netstat -an |grep :3306
tcp 0 0 :::3306 :::* LISTEN
[root@localhost ~]# chkconfig --list |grep mysql
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
重新启动Server:
[root@localhost mysql]# service mysql start
Starting MySQL (Percona Server).....................................................................................................The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid).[FAILED]
查看错误日志:
[root@rh64 ~]# more /var/log/mysqld.log
150908 16:01:49 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2015-09-08 16:01:49 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defa
ults_for_timestamp server option (see documentation for more details).
2015-09-08 16:01:49 0 [Note] /usr/sbin/mysqld (mysqld 5.6.25-73.1) starting as process 3349 ...
2015-09-08 16:01:49 3349 [Note] Plugin 'FEDERATED' is disabled.
2015-09-08 16:01:49 3349 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-09-08 16:01:49 3349 [Note] InnoDB: The InnoDB memory heap is disabled
2015-09-08 16:01:49 3349 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-09-08 16:01:49 3349 [Note] InnoDB: Memory barrier is not used
2015-09-08 16:01:49 3349 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-09-08 16:01:49 3349 [Note] InnoDB: Using Linux native AIO
2015-09-08 16:01:49 3349 [Note] InnoDB: Not using CPU crc32 instructions
2015-09-08 16:01:49 3349 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-09-08 16:01:49 3349 [Note] InnoDB: Completed initialization of buffer pool
2015-09-08 16:01:49 3349 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
2015-09-08 16:01:49 3349 [Note] InnoDB: Check that you do not already have another mysqld process using the sam
e InnoDB data or log files.
2015-09-08 16:01:49 3349 [Note] InnoDB: Retrying to lock the first data file
2015-09-08 16:01:50 3349 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
2015-09-08 16:01:50 3349 [Note] InnoDB: Check that you do not already have another mysqld process using the sam
e InnoDB data or log files.
2015-09-08 16:01:51 3349 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
2015-09-08 16:01:51 3349 [Note] InnoDB: Check that you do not already have another mysqld process using the sam
e InnoDB data or log files.
2015-09-08 16:01:52 3349 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
2015-09-08 16:01:52 3349 [Note] InnoDB: Check that you do not already have another mysqld process using the sam
e InnoDB data or log files.
2015-09-08 16:01:53 3349 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
2015-09-08 16:01:53 3349 [Note] InnoDB: Check that you do not already have another mysqld process using the sam
e InnoDB data or log files.
2015-09-08 16:01:54 3349 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
2015-09-08 16:01:54 3349 [Note] InnoDB: Check that you do not already have another mysqld process using the sam
e InnoDB data or log files.
2015-09-08 16:01:55 3349 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
2015-09-08 16:01:55 3349 [Note] InnoDB: Check that you do not already have another mysqld process using the sam
e InnoDB data or log files.
2015-09-08 16:01:56 3349 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
在安装Linux系统时,系统自带了mysql server,卸载系统自带mysql server;但系统启动是,会自动启动原来的mysql server,导致启动后面安装的Percona Server无法启动,关闭mysql server在系统的自动启动。
[root@localhost ~]# chkconfig --list |grep mysql
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@localhost ~]# chkconfig --level 235 mysql off
[root@localhost ~]# service mysql stop
MySQL (Percona Server) PID file could not be found![FAILED]
[root@localhost ~]# chkconfig --list |grep mysql
mysql 0:off 1:off 2:off 3:off 4:on 5:off 6:off
[root@localhost ~]# netstat -an |grep :3306
tcp 0 0 :::3306 :::* LISTEN
重新启动系统:
[root@rh64 ~]# service mysql start
Starting MySQL (Percona Server)..[ OK ]
[root@rh64 ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.25-73.1 Percona Server (GPL), Release 73.1, Revision 07b797f
Copyright (c) 2009-2015 Percona LLC and/or its affiliates
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
mysql server正常启动!
查看系统信息:
[root@rh64 ~]# ls -l /var/lib/mysql
total 110620
-rw-rw----. 1 mysql mysql 56 Sep 6 18:08 auto.cnf
-rw-rw----. 1 mysql mysql 12582912 Sep 8 16:18 ibdata1
-rw-rw----. 1 mysql mysql 50331648 Sep 8 16:18 ib_logfile0
-rw-rw----. 1 mysql mysql 50331648 Sep 6 18:06 ib_logfile1
drwx------. 2 mysql mysql 4096 Sep 6 18:06 mysql
srwxrwxrwx. 1 mysql mysql 0 Sep 8 16:18 mysql.sock
drwx------. 2 mysql mysql 4096 Sep 6 18:06 performance_schema
-rw-rw----. 1 mysql mysql 5 Sep 8 16:18 rh64.pid
-rw-r--r--. 1 root root 293 Sep 6 18:07 RPM_UPGRADE_HISTORY
-rw-r--r--. 1 mysql mysql 293 Sep 6 18:07 RPM_UPGRADE_MARKER-LAST
drwx------. 2 mysql mysql 4096 Sep 6 18:06 test
查看系统日志:
[root@rh64 ~]# tail /var/log/mysqld.log
2015-09-08 16:18:10 2370 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.25-73.1 started; log sequence number 1626017
2015-09-08 16:18:10 2370 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.
2015-09-08 16:18:10 2370 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
2015-09-08 16:18:10 2370 [Note] Server hostname (bind-address): '*'; port: 3306
2015-09-08 16:18:10 2370 [Note] IPv6 is available.
2015-09-08 16:18:10 2370 [Note] - '::' resolves to '::';
2015-09-08 16:18:10 2370 [Note] Server socket created on IP: '::'.
2015-09-08 16:18:10 2370 [Note] Event Scheduler: Loaded 0 events
2015-09-08 16:18:10 2370 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.6.25-73.1' socket: '/var/lib/mysql/mysql.sock' port: 3306 Percona Server (GPL), Release 73.1, Revision 07b797f