本来是心血来潮修改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. Hdu-1452-Happy 2004-费马小定理推除法逆元+同余定理+积性函数

    Consider a positive integer X,and let S be the sum of all positive integer divisors of 2004^X. Your ...

  2. day 84 Vue学习之vue-cli脚手架下载安装及配置

    Vue学习之vue-cli脚手架下载安装及配置   1. 先下载node.js,下载地址:https://nodejs.org/en/download/ 找个目录保存,解压下载的文件,然后配置环境变量 ...

  3. JSP页面静态化总结之一使用URLRewrite实现url地址伪静态化

    JSP页面静态化总结之一使用URLRewrite实现url地址伪静态化 1使用URLRewrite实现url地址伪静态化1.1URLRewirte的用处 1.满足搜索引擎的要求. 2.隐藏技术实现,提 ...

  4. 使用maven搭建Hibernate

    使用maven搭建Hibernate框架(web项目) create table USERS ( ID NUMBER not null primary key, NAME ), PASSWORD ), ...

  5. <day001>存储到Mysql、mongoDB数据库+简单的Ajax请求+os模块+进程池+MD5

    任务1:记住如何存储到Mysql.mongoDB数据库 ''' 存储到Mysql ''' import pymysql.cursors class QuotePipeline(object): def ...

  6. LGP5495 Dirichlet 前缀和

    题目 不是很明白为什么要叫做模板 考虑到\(a_i\)能对\(b_j\)产生贡献,当且仅当\(a_i=\prod p_k^{a_k},b_j=\prod p_k^{b_k},\forall k \ a ...

  7. 面试系列17 redis cluster

    1.redis cluster介绍 redis cluster (1)自动将数据进行分片,每个master上放一部分数据(2)提供内置的高可用支持,部分master不可用时,还是可以继续工作的 在re ...

  8. js 实时监听textarea输入

    html: <textarea class="area" name="" id="text1" maxlength="100 ...

  9. ant的build.xml备份

    <?xml version="1.0" encoding="UTF-8" ?> <project default="rerun&qu ...

  10. 洛谷P2325 [SCOI2005]王室联邦

    P2325 [SCOI2005]王室联邦 题目描述 "余"人国的国王想重新编制他的国家.他想把他的国家划分成若干个省,每个省都由他们王室联邦的一个成员来管理. 他的国家有n个城市, ...