欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

MySQL无法启动的解决办法

程序员文章站 2023-10-30 19:56:34
mysql无法启动的解决办法 mysql无法启动 在停止mysql之后,执行了一些操作(如修改主机名),重新启动 mysql,发现起不来。 ...

mysql无法启动的解决办法

mysql无法启动

在停止mysql之后,执行了一些操作(如修改主机名),重新启动 mysql,发现起不来。 

[root@www ~]$ service mysql start 
starting mysql..^[[a.................................................................................................. error! the server quit without updating pid file (/disk/mysql/www.pid).
[root@www ~]$ service mysql stop 
 error! mysql server pid file could not be found!
[root@www ~]$ service mysql stop 
 error! mysql server pid file could not be found!
[root@www ~]$ service mysql start 
starting mysql..................
还是老样子,只好 ctr+c 掉。
[root@www ~]$
 

实在是启动不了,看一下日志:/disk/mysql/www.err 

120608 09:56:17 mysqld_safe starting mysqld daemon with databases from /disk/mysql
120608 9:56:17 [note] plugin 'federated' is disabled.
120608 9:56:17 innodb: the innodb memory heap is disabled
120608 9:56:17 innodb: mutexes and rw_locks use innodb's own implementation
120608 9:56:17 innodb: compressed tables use zlib 1.2.3
120608 9:56:17 innodb: using linux native aio
120608 9:56:17 innodb: initializing buffer pool, size = 128.0m
120608 9:56:17 innodb: completed initialization of buffer pool
innodb: unable to lock ./ibdata1, error: 11
innodb: check that you do not already have another mysqld process
innodb: using the same innodb data or log files.
120608 9:56:17 innodb: retrying to lock the first data file
innodb: unable to lock ./ibdata1, error: 11
innodb: check that you do not already have another mysqld process
innodb: using the same innodb data or log files.
innodb: unable to lock ./ibdata1, error: 11
innodb: check that you do not already have another mysqld process
innodb: using the same innodb data or log files.
innodb: unable to lock ./ibdata1, error: 11
...

 好像是原来的 mysqld 并没有停下来。

强制终止 mysqld

[root@www ~]$ ps -ef|grep mysql 
root   4769   1 0 jun06 ?    00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/disk/mysql --pid-file=/disk/mysql/localhost.pid
mysql   4874 4769 0 jun06 ?    00:04:04 /usr/sbin/mysqld --basedir=/usr --datadir=/disk/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --log-error=/disk/mysql/localhost.err --pid-file=/disk/mysql/localhost.pid --socket=/disk/mysql/mysql.sock
root   17947   1 0 09:56 pts/1  00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/disk/mysql --pid-file=/disk/mysql/www.pid
mysql  18052 17947 0 09:56 pts/1  00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/disk/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --log-error=/disk/mysql/www.err --pid-file=/disk/mysql/www.pid --socket=/disk/mysql/mysql.sock
root   18099 17514 0 09:56 pts/1  00:00:00 grep mysql
[root@www ~]$ killall mysqld 
[root@www ~]$ killall mysqld 
[root@www ~]$ ps -ef|grep mysql 
root   18116 17514 0 09:57 pts/1  00:00:00 grep mysql
[root@www ~]$

 启动 mysqld ,现在执行多次启动命令都没有问题。

[root@www ~]$ service mysql start 
starting mysql. success! 
[root@www ~]$ 
[root@www ~]$ 
[root@www ~]$ 
[root@www ~]$ 
[root@www ~]$ service mysql start 
starting mysql success! 
[root@www ~]$
 

前面 www.err 文件中显示的 error: 11 到底是什么,看下:

[root@www ~]$ perror 11 
os error code 11: resource temporarily unavailable
[root@www ~]$ 
[root@www ~]$

 如有疑问请留言或者到本站社区交流讨论,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!