时间:2021-07-01 10:21:17 帮助过:13人阅读
我这里没有重启虚拟机,使用命令临时生效。退出后重新登录主机名已更改为VMUest。本以为大功告成,手贱查看下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