本来是心血来潮修改CentOS6.5的主机名

/****** 修改CentOS6.5默认主机名 ******/
、备份系统网络配置文件
[root@localhost ~]# cp /etc/sysconfig/network /etc/sysconfig/network.`date +%Y%m%d.%H%M%S`
、备份系统网络配置文件
[root@localhost ~]# vim /etc/sysconfig/network
修改HOSTNAME为我们想要的名字VMUest 、备份hosts文件
[root@localhost ~]# cp /etc/hosts /etc/hosts.`date +%Y%m%d.%H%M%S`
、修改hosts文件
[root@localhost ~]# vim /etc/hosts
在127.0.0.1后添加主机名VMUest(注意空格) 、修改上面两个文件后,需重启才永久生效。使用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
drwxr-xr-x. mysql mysql Mar : bin
-rw-r--r--. mysql mysql Nov : COPYING
drwxr-xr-x. mysql mysql Mar : data
drwxr-xr-x. mysql mysql Mar : docs
drwxr-xr-x. mysql mysql Mar : include
drwxr-xr-x. mysql mysql Mar : lib
drwxr-xr-x. mysql mysql Mar : man
-rw-r--r--. root root Mar : my.cnf
srwxrwxrwx. mysql mysql Mar : mysql.sock
drwxr-xr-x. mysql mysql Mar : mysql-test
-rw-r--r--. mysql mysql Nov : README
drwxr-xr-x. mysql mysql Mar : scripts
drwxr-xr-x. mysql mysql Mar : share
drwxr-xr-x. mysql mysql Mar : sql-bench
drwxr-xr-x. mysql mysql Mar : support-files
[root@VMUest mysql]# cd data
[root@VMUest data]# ll
total
-rw-rw----. mysql mysql Mar : auto.cnf
-rw-rw----. mysql mysql Mar : ibdata1
-rw-rw----. mysql mysql Mar : ib_logfile0
-rw-rw----. mysql mysql Mar : ib_logfile1
-rw-rw----. mysql mysql Mar : localhost.localdomain.err
-rw-rw----. mysql mysql Mar : localhost.localdomain.pid
drwx------. mysql mysql Mar : mysql
drwx------. mysql mysql Mar : performance_schema
drwx------. mysql mysql Mar : sakila
drwxr-xr-x. mysql mysql Mar : 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)

-- ::  [Note] Plugin 'FEDERATED' is disabled.
-- :: [Note] InnoDB: Using atomics to ref count buffer pool pages
-- :: [Note] InnoDB: The InnoDB memory heap is disabled
-- :: [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
-- :: [Note] InnoDB: Memory barrier is not used
-- :: [Note] InnoDB: Compressed tables use zlib 1.2.
-- :: [Note] InnoDB: Not using CPU crc32 instructions
-- :: [Note] InnoDB: Initializing buffer pool, size = 128.0M
-- :: [Note] InnoDB: Completed initialization of buffer pool
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [Note] InnoDB: Retrying to lock the first data file
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock ./ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [Note] InnoDB: Unable to open the first data file
-- :: b77876d0 InnoDB: Operating system error number in a file operation.
InnoDB: Error number 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
-- :: [ERROR] InnoDB: Can't open './ibdata1'
-- :: [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!
-- :: [ERROR] Plugin 'InnoDB' init function returned error.
-- :: [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
-- :: [ERROR] Unknown/unsupported storage engine: InnoDB
-- :: [ERROR] Aborting -- :: [Note] Binlog end
-- :: [Note] Shutting down plugin 'partition'
-- :: [Note] Shutting down plugin 'ARCHIVE'
-- :: [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
-- :: [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
-- :: [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
-- :: [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
-- :: [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
-- :: [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
-- :: [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
-- :: [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
-- :: [Note] Shutting down plugin 'INNODB_SYS_TABLES'
-- :: [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
-- :: [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
-- :: [Note] Shutting down plugin 'INNODB_FT_CONFIG'
-- :: [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
-- :: [Note] Shutting down plugin 'INNODB_FT_DELETED'
-- :: [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
-- :: [Note] Shutting down plugin 'INNODB_METRICS'
-- :: [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
-- :: [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
-- :: [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
-- :: [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
-- :: [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
-- :: [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
-- :: [Note] Shutting down plugin 'INNODB_CMPMEM'
-- :: [Note] Shutting down plugin 'INNODB_CMP_RESET'
-- :: [Note] Shutting down plugin 'INNODB_CMP'
-- :: [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
-- :: [Note] Shutting down plugin 'INNODB_LOCKS'
-- :: [Note] Shutting down plugin 'INNODB_TRX'
-- :: [Note] Shutting down plugin 'BLACKHOLE'
-- :: [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
-- :: [Note] Shutting down plugin 'MEMORY'
-- :: [Note] Shutting down plugin 'MRG_MYISAM'
-- :: [Note] Shutting down plugin 'MyISAM'
-- :: [Note] Shutting down plugin 'CSV'
-- :: [Note] Shutting down plugin 'sha256_password'
-- :: [Note] Shutting down plugin 'mysql_old_password'
-- :: [Note] Shutting down plugin 'mysql_native_password'
-- :: [Note] Shutting down plugin 'binlog'
-- :: [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 : ? :: /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/localhost.localdomain.pid
mysql : ? :: /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=
root : pts/ :: grep mysql
#mysqld进程打开了哪些文件:
[root@VMUest data]# lsof -c mysqld |grep localhost
mysqld mysql 1w REG , /usr/local/mysql/data/localhost.localdomain.err
mysqld mysql 2w REG , /usr/local/mysql/data/localhost.localdomain.err

发现有一个2060的进程在运行,并且打开localhost.localdomain.err文件。原以为删除这个文件(rm -f localhost.localdomain.error)会正常,结果删除过程不报错,实际却没删除!于是强制kill掉进程

[root@VMUest data]# kill -
[root@VMUest data]# ps -ef |grep mysql
root : pts/ :: 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)删除即可。遇到了,纠结下,解决掉。

修改CentOS6.5主机名引起MySQL5.6.35服务问题的更多相关文章

  1. 【CentOS】centos如何修改你的主机名

    转载地址:https://www.linuxidc.com/Linux/2014-11/109238.htm ============================================= ...

  2. CentOS6.5源码安装MySQL5.6.35

    CentOS6.5源码安装MySQL5.6.35 一.卸载旧版本 1.使用下面的命令检查是否安装有mysql [root@localhost tools]# rpm -qa|grep -i mysql ...

  3. Ubuntu之修改用户名和主机名

    记得曾几何时,想把自己电脑的“乌班兔儿”取个响亮的名字,但是问了很久度娘和谷哥,都要我把当前用户删除了(userdel -r xxx),重新建一个用户(adduser xxx),但是,我的电脑是所有环 ...

  4. mac 修改系统配置参数 主机名 等

    mac 修改系统配置参数,可以使用 命令 scutil 参考网址: https://developer.apple.com/library/mac/documentation/Darwin/Refer ...

  5. 修改MacBook Pro主机名,共享电脑名

    https://support.apple.com/kb/PH25384?viewlocale=zh_CN&locale=zh_CN http://www.ituring.com.cn/art ...

  6. CentOS 7 修改主机名

    今天在阿里云上买了一个centos7的服务器,连接上以后,发现一个很长很长的主机名,看着让人很是不爽,就想着怎样将其改成一个有个性的名字. 这里我想说的是,在centos7 版本的linux系统上和c ...

  7. CentOS7修改主机名(hostname)

    Linux中的hostname在大多数应用中至为重要,例如有些应用强制使用主机名称而不能使用IP地址,如果默认主机名称都为localhost.localdomain 的话那一定会出现问题,而且看起来也 ...

  8. Centos7系统下修改主机名操作笔记

    习惯了在Centos6系统下修改主机名的操作,但是Centos7下修改主机名的操作却大不相同!操作笔记如下: 在CentOS中,有三种定义的主机名:静态的(static),瞬态的(transient) ...

  9. CentOS7运维管理笔记(12)----修改主机名

    CentOS修改主机名 CentOS7和CentOS6.5 修改主机名的方法略有不同. 通过 hostname 命令可以查看当前的主机名. 1. 临时修改主机名 通过 'hostname 新的主机名' ...

随机推荐

  1. 委托_deleget

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  2. Python 函数与内置函数

    1.函数的基本定义 def 函数名称(参数) 执行语句 return 返回值 def : 定义函数的关键字: 函数名称:顾名思义,就是函数的名字,可以用来调用函数,不能使用关键字来命名,做好是用这个函 ...

  3. Astar伪代码

    while(OPEN!=NULL) { 从OPEN表中取估价值f最小的节点n; if(n节点==目标节点){ break; } for(当前节点n 的每个子节点X) { 算X的估价值; if(X in ...

  4. DNS配置-BIND安装配置全过程

    下载地址:ftp://ftp.isc.org/isc/ 下载bind,我下载的是bind-9.11.13.tar.gz 我下载的文件放在/root目录下进入目录解压缩 [root@localhost ...

  5. visual studio 注释模板

    /*----------------------------------------------------------------* 项目名称 :$rootnamespace$* 项目描述 :* 类 ...

  6. C#查找List 某一段数据

    public void SelectData() { List<int> r = new List<int>(); r.Add(); r.Add(); r.Add(); r.A ...

  7. mybatis 查询sql时foreach使用法

    找到俩个例子摘下来 sql查询用户in传list参数 <select id="getEmpsByConditionForeach" resultType="com. ...

  8. MapReduce工作流程

  9. LINUX挂接光盘镜像文件

    1.从光盘制作光盘镜像文件.将光盘放入光驱,执行下面的命令. #cp /dev/cdrom /home/sunky/mydisk.iso 或 #dd if=/dev/cdrom of=/home/su ...

  10. LUOGU P1291 [SHOI2002]百事世界杯之旅 (期望dp)

    传送门 解题思路 期望$dp$.因为这个是期望步数,所以要倒着推.那么这道题就变得一脸可做了,设$f[i]$表示还有$i$张牌没有收集的期望,那么考虑再抽一张,有$(n-i)/n$的概率抽到抽过的牌, ...