首页 > 代码库 > 修改CentOS6.5主机名引起MySQL5.6.35服务问题

修改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为我们想要的名字VMUest3、备份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服务状态

[root@VMUest ~]# whereis mysqlmysql: /usr/bin/mysql /usr/local/mysql[root@VMUest ~]# cd /usr/local/mysql[root@VMUest mysql]# lltotal 72drwxr-xr-x.  2 mysql mysql  4096 Mar 10 13:13 bin-rw-r--r--.  1 mysql mysql 17987 Nov 28 21:36 COPYINGdrwxr-xr-x.  6 mysql mysql  4096 Mar 12 09:01 datadrwxr-xr-x.  2 mysql mysql  4096 Mar 10 13:13 docsdrwxr-xr-x.  3 mysql mysql  4096 Mar 10 13:13 includedrwxr-xr-x.  3 mysql mysql  4096 Mar 10 13:13 libdrwxr-xr-x.  4 mysql mysql  4096 Mar 10 13:13 man-rw-r--r--.  1 root  root   1123 Mar 10 14:31 my.cnfsrwxrwxrwx.  1 mysql mysql     0 Mar 12 09:01 mysql.sockdrwxr-xr-x. 10 mysql mysql  4096 Mar 10 13:14 mysql-test-rw-r--r--.  1 mysql mysql  2496 Nov 28 21:36 READMEdrwxr-xr-x.  2 mysql mysql  4096 Mar 10 13:13 scriptsdrwxr-xr-x. 28 mysql mysql  4096 Mar 10 13:14 sharedrwxr-xr-x.  4 mysql mysql  4096 Mar 10 13:14 sql-benchdrwxr-xr-x.  2 mysql mysql  4096 Mar 10 13:14 support-files[root@VMUest mysql]# cd data[root@VMUest data]# lltotal 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.piddrwx------. 2 mysql mysql     4096 Mar 10 13:52 mysqldrwx------. 2 mysql mysql     4096 Mar 10 13:52 performance_schemadrwx------. 2 mysql mysql     4096 Mar 10 16:38 sakiladrwxr-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 startStarting 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 startStarting 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 pages2017-03-12 11:04:49 6113 [Note] InnoDB: The InnoDB memory heap is disabled2017-03-12 11:04:49 6113 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins2017-03-12 11:04:49 6113 [Note] InnoDB: Memory barrier is not used2017-03-12 11:04:49 6113 [Note] InnoDB: Compressed tables use zlib 1.2.32017-03-12 11:04:49 6113 [Note] InnoDB: Not using CPU crc32 instructions2017-03-12 11:04:49 6113 [Note] InnoDB: Initializing buffer pool, size = 128.0M2017-03-12 11:04:49 6113 [Note] InnoDB: Completed initialization of buffer pool2017-03-12 11:04:50 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 112017-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 file2017-03-12 11:04:51 6113 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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: 112017-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 file2017-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 atInnoDB: http://dev.mysql.com/doc/refman/5.6/en/operating-system-error-codes.html2017-03-12 11:06:30 6113 [ERROR] InnoDB: Cant open ./ibdata12017-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: InnoDB2017-03-12 11:06:30 6113 [ERROR] Aborting2017-03-12 11:06:30 6113 [Note] Binlog end2017-03-12 11:06:30 6113 [Note] Shutting down plugin partition2017-03-12 11:06:30 6113 [Note] Shutting down plugin ARCHIVE2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_SYS_DATAFILES2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_SYS_TABLESPACES2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_SYS_FOREIGN_COLS2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_SYS_FOREIGN2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_SYS_FIELDS2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_SYS_COLUMNS2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_SYS_INDEXES2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_SYS_TABLESTATS2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_SYS_TABLES2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_FT_INDEX_TABLE2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_FT_INDEX_CACHE2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_FT_CONFIG2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_FT_BEING_DELETED2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_FT_DELETED2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_FT_DEFAULT_STOPWORD2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_METRICS2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_BUFFER_POOL_STATS2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_BUFFER_PAGE_LRU2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_BUFFER_PAGE2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_CMP_PER_INDEX_RESET2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_CMP_PER_INDEX2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_CMPMEM_RESET2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_CMPMEM2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_CMP_RESET2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_CMP2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_LOCK_WAITS2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_LOCKS2017-03-12 11:06:30 6113 [Note] Shutting down plugin INNODB_TRX2017-03-12 11:06:30 6113 [Note] Shutting down plugin BLACKHOLE2017-03-12 11:06:30 6113 [Note] Shutting down plugin PERFORMANCE_SCHEMA2017-03-12 11:06:30 6113 [Note] Shutting down plugin MEMORY2017-03-12 11:06:30 6113 [Note] Shutting down plugin MRG_MYISAM2017-03-12 11:06:30 6113 [Note] Shutting down plugin MyISAM2017-03-12 11:06:30 6113 [Note] Shutting down plugin CSV2017-03-12 11:06:30 6113 [Note] Shutting down plugin sha256_password2017-03-12 11:06:30 6113 [Note] Shutting down plugin mysql_old_password2017-03-12 11:06:30 6113 [Note] Shutting down plugin mysql_native_password2017-03-12 11:06:30 6113 [Note] Shutting down plugin binlog2017-03-12 11:06:30 6113 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
View Code

关键字"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 mysqlroot      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.pidmysql     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=3306root      6411  4813  0 11:18 pts/1    00:00:00 grep mysql#mysqld进程打开了哪些文件:[root@VMUest data]# lsof -c mysqld |grep localhostmysqld    2060 mysql    1w   REG        8,2    28768 160815 /usr/local/mysql/data/localhost.localdomain.errmysqld    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 mysqlroot      6925  4813  0 11:26 pts/1    00:00:00 grep mysql[root@VMUest data]# lsof -c mysqld[root@VMUest data]# service mysql startStarting MySQL...... SUCCESS!

重新启动MySQL成功......
总结,如果不修改主机名就不会遇到这种问题,如果修改了主机名之后重启服务器也不会出现这种问题。碰巧使用命令生效,然后去查看MySQL的状态,进而掉入各种坑。也好,遇到了,解决掉。

修改CentOS6.5主机名引起MySQL5.6.35服务问题