修改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
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 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)刪除即可。遇到了,糾結下,解決掉。


注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
粤ICP备14056181号  © 2014-2020 ITdaan.com