修改CentOS6.5主机名引起MySQL5.6.35服务问题
本来是心血来潮修改CentOS6.5的主机名
/****** 修改CentOS6.5默认主机名 ******/ 1、备份系统网络配置文件 [root@localhost ~]# cp /etc/sysconfig/network /etc/sysconfig/network.`date +%Y%m%d.%H%M%S` 2、备份系统网络配置文件 [root@localhost ~]# vim /etc/sysconfig/network 修改HOSTNAME为我们想要的名字VMUest 3、备份hosts文件 [root@localhost ~]# cp /etc/hosts /etc/hosts.`date +%Y%m%d.%H%M%S` 4、修改hosts文件 [root@localhost ~]# vim /etc/hosts 在127.0.0.1后添加主机名VMUest(注意空格) 5、修改上面两个文件后,需重启才永久生效。使用hostname可临时生效 [root@localhost ~]# hostname VMUest
我这里没有重启虚拟机,使用命令临时生效。退出后重新登录主机名已更改为VMUest。本以为大功告成,手贱查看下mysql服务状态(之前mysql服务设置为自动启动)
[root@VMUest ~]# whereis mysql mysql: /usr/bin/mysql /usr/local/mysql [root@VMUest ~]# cd /usr/local/mysql [root@VMUest mysql]# ll total 72 drwxr-xr-x. 2 mysql mysql 4096 Mar 10 13:13 bin -rw-r--r--. 1 mysql mysql 17987 Nov 28 21:36 COPYING drwxr-xr-x. 6 mysql mysql 4096 Mar 12 09:01 data drwxr-xr-x. 2 mysql mysql 4096 Mar 10 13:13 docs drwxr-xr-x. 3 mysql mysql 4096 Mar 10 13:13 include drwxr-xr-x. 3 mysql mysql 4096 Mar 10 13:13 lib drwxr-xr-x. 4 mysql mysql 4096 Mar 10 13:13 man -rw-r--r--. 1 root root 1123 Mar 10 14:31 my.cnf srwxrwxrwx. 1 mysql mysql 0 Mar 12 09:01 mysql.sock drwxr-xr-x. 10 mysql mysql 4096 Mar 10 13:14 mysql-test -rw-r--r--. 1 mysql mysql 2496 Nov 28 21:36 README drwxr-xr-x. 2 mysql mysql 4096 Mar 10 13:13 scripts drwxr-xr-x. 28 mysql mysql 4096 Mar 10 13:14 share drwxr-xr-x. 4 mysql mysql 4096 Mar 10 13:14 sql-bench drwxr-xr-x. 2 mysql mysql 4096 Mar 10 13:14 support-files [root@VMUest mysql]# cd data [root@VMUest data]# ll total 176188 -rw-rw----. 1 mysql mysql 56 Mar 10 14:01 auto.cnf -rw-rw----. 1 mysql mysql 79691776 Mar 12 09:01 ibdata1 -rw-rw----. 1 mysql mysql 50331648 Mar 12 09:01 ib_logfile0 -rw-rw----. 1 mysql mysql 50331648 Mar 10 13:52 ib_logfile1 -rw-rw----. 1 mysql mysql 28768 Mar 12 10:19 localhost.localdomain.err -rw-rw----. 1 mysql mysql 5 Mar 12 09:01 localhost.localdomain.pid drwx------. 2 mysql mysql 4096 Mar 10 13:52 mysql drwx------. 2 mysql mysql 4096 Mar 10 13:52 performance_schema drwx------. 2 mysql mysql 4096 Mar 10 16:38 sakila drwxr-xr-x. 2 mysql mysql 4096 Mar 10 17:36 test [root@VMUest data]# service mysql status ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists [root@VMUest data]# service mysql stop ERROR! MySQL server PID file could not be found! [root@VMUest data]# service mysql restart ERROR! MySQL server PID file could not be found! Starting MySQL.Logging to '/usr/local/mysql/data/VMUest.err'. .............................................................................................................. ERROR! The server quit without updating PID file (/usr/local/mysql/data/VMUest.pid).
此时还可以操作MySQL数据库(查询数据、创建表格都正常)。搜索关键字"ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists",给出的解决方案是删除文件/var/lock/subsys/mysql,重新启动如果依旧出错考虑删除pid file。
[root@VMUest data]# rm -f /var/lock/subsys/mysql [root@VMUest data]# service mysql status ERROR! MySQL is not running [root@VMUest data]# service mysql start Starting MySQL...................................................................................................... ERROR! The server quit without updating PID file (/usr/local/mysql/data/VMUest.pid). [root@VMUest data]# rm -f localhost.localdomain.pid [root@VMUest data]# service mysql start Starting MySQL..................................................................................................... ERROR! The server quit without updating PID file (/usr/local/mysql/data/VMUest.pid).
到此时才想起去查看错误日志(.err)
2017-03-12 11:04:49 6113 [Note] Plugin 'FEDERATED' is disabled. 2017-03-12 11:04:49 6113 [Note] InnoDB: Using atomics to ref count buffer pool pages 2017-03-12 11:04:49 6113 [Note] InnoDB: The InnoDB memory heap is disabled 2017-03-12 11:04:49 6113 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2017-03-12 11:04:49 6113 [Note] InnoDB: Memory barrier is not used 2017-03-12 11:04:49 6113 [Note] InnoDB: Compressed tables use zlib 1.2.3 2017-03-12 11:04:49 6113 [Note] InnoDB: Not using CPU crc32 instructions 2017-03-12 11:04:49 6113 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2017-03-12 11:04:49 6113 [Note] InnoDB: Completed initialization of buffer pool 2017-03-12 11:04:50 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:04:50 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:04:50 6113 [Note] InnoDB: Retrying to lock the first data file 2017-03-12 11:04:51 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:04:51 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:04:52 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:04:52 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:04:53 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:04:53 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:04:54 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:04:54 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:04:55 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:04:55 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:04:56 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:04:56 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:04:57 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:04:57 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:04:58 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:04:58 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:04:59 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:04:59 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:00 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:00 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:01 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:01 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:02 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:02 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:03 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:03 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:04 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:04 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:05 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:05 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:06 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:06 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:07 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:07 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:08 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:08 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:09 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:09 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:10 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:10 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:11 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:11 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:12 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:12 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:13 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:13 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:14 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:14 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:15 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:15 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:16 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:16 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:17 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:17 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:18 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:18 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:19 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:19 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:20 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:20 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:21 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:21 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:22 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:22 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:23 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:23 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:24 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:24 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:25 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:25 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:26 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:26 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:27 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:27 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:28 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:28 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:29 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:29 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:30 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:30 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:31 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:31 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:32 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:32 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:33 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:33 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:34 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:34 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:35 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:35 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:36 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:36 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:37 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:37 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:38 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:38 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:39 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:39 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:40 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:40 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:41 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:41 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:42 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:42 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:43 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:43 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:44 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:44 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:45 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:45 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:46 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:46 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:47 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:47 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:48 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:48 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:49 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:49 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:50 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:50 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:51 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:51 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:52 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:52 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:53 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:53 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:54 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:54 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:55 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:55 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:56 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:56 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:57 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:57 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:58 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:58 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:05:59 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:05:59 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:00 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:00 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:01 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:01 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:02 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:02 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:03 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:03 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:04 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:04 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:05 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:05 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:06 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:06 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:07 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:07 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:08 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:08 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:09 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:09 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:10 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:10 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:11 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:11 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:12 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:12 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:13 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:13 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:14 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:14 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:15 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:15 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:16 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:16 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:17 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:17 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:18 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:18 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:19 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:19 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:20 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:20 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:21 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:21 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:22 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:22 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:23 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:23 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:24 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:24 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:25 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:25 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:26 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:26 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:27 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:27 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:28 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:28 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:29 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:29 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:30 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11 2017-03-12 11:06:30 6113 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2017-03-12 11:06:30 6113 [Note] InnoDB: Unable to open the first data file 2017-03-12 11:06:30 b77876d0 InnoDB: Operating system error number 11 in a file operation. InnoDB: Error number 11 means 'Resource temporarily unavailable'. InnoDB: Some operating system error numbers are described at InnoDB: http://dev.mysql.com/doc/refman/5.6/en/operating-system-error-codes.html 2017-03-12 11:06:30 6113 [ERROR] InnoDB: Can't open './ibdata1' 2017-03-12 11:06:30 6113 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data! 2017-03-12 11:06:30 6113 [ERROR] Plugin 'InnoDB' init function returned error. 2017-03-12 11:06:30 6113 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 2017-03-12 11:06:30 6113 [ERROR] Unknown/unsupported storage engine: InnoDB 2017-03-12 11:06:30 6113 [ERROR] Aborting 2017-03-12 11:06:30 6113 [Note] Binlog end 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'partition' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'ARCHIVE' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_SYS_FIELDS' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_SYS_INDEXES' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_SYS_TABLES' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_FT_CONFIG' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_FT_DELETED' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_METRICS' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_CMPMEM' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_CMP_RESET' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_CMP' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_LOCK_WAITS' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_LOCKS' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'INNODB_TRX' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'BLACKHOLE' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'MEMORY' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'MRG_MYISAM' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'MyISAM' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'CSV' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'sha256_password' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'mysql_old_password' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'mysql_native_password' 2017-03-12 11:06:30 6113 [Note] Shutting down plugin 'binlog' 2017-03-12 11:06:30 6113 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
关键字"Check that you do not already have another mysqld process using the same InnoDB data or log files",是否有其他进程使用相同的文件?
#使用ps命令查看是否有mysqld进程在运行 [root@VMUest data]# ps -ef |grep mysql root 1858 1 0 09:00 ? 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/localhost.localdomain.pid mysql 2060 1858 0 09:00 ? 00:00:06 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/localhost.localdomain.err --pid-file=/usr/local/mysql/data/localhost.localdomain.pid --port=3306 root 6411 4813 0 11:18 pts/1 00:00:00 grep mysql #mysqld进程打开了哪些文件: [root@VMUest data]# lsof -c mysqld |grep localhost mysqld 2060 mysql 1w REG 8,2 28768 160815 /usr/local/mysql/data/localhost.localdomain.err mysqld 2060 mysql 2w REG 8,2 28768 160815 /usr/local/mysql/data/localhost.localdomain.err
发现有一个2060的进程在运行,并且打开localhost.localdomain.err文件。原以为删除这个文件(rm -f localhost.localdomain.error)会正常,结果删除过程不报错,实际却没删除!于是强制kill掉进程
[root@VMUest data]# kill -9 2060 [root@VMUest data]# ps -ef |grep mysql root 6925 4813 0 11:26 pts/1 00:00:00 grep mysql [root@VMUest data]# lsof -c mysqld [root@VMUest data]# service mysql start Starting MySQL...... SUCCESS!
重新启动MySQL成功......
总结,如果不修改主机名就不会遇到这种问题,如果修改了主机名之后马上重启服务器也不会出现这种问题。碰巧使用命令生效,然后去查看MySQL的状态,进而掉入各种坑。
[root@VMUest ~]# cat /etc/init.d/mysql |grep hostname mysqld_pid_file_path=$datadir/`hostname`.pid
其实问题的根源就是使用hostname临时修改主机名,service mysql **会调用文件/etc/init.d/mysql,此文件使用`hostname`会获取修改后的主机名,导致中间的逻辑"异常"(实际MySQL服务一直正常)。吐槽下,测试过程中虚拟机连同宿主机崩掉,强制重启后虚拟机报"锁定文件失败,打不开磁盘或快照所依赖的磁盘",只需将存放虚拟机系统文件的文件夹中的.lck文件(类似于M33061.lck、M20423.lck、M13879.lck)删除即可。遇到了,纠结下,解决掉。
因为不懂,所以加倍努力!