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

Posted 醒嘞

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了修改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: CentOS6.5环境初始化

CentOS修改主机名

Centos6.5安装MySQL5.6备忘记录

centos7和centos6.5环境rpm方式安装mysql5.7和mysql5.6详解

CentOS6.5源码安装MySQL5.6.35

centos6.5 安装mysql5.6