码迷,mamicode.com
首页 > 数据库 > 详细

centos6.5安装MYSQL“mysqld已死,但是subsys被锁”的解决方案

时间:2015-01-25 22:42:05      阅读:256      评论:0      收藏:0      [点我收藏+]

标签:“mysqld已死   但是subsys被锁”   

今天安装好了centos 6.5  32位系统,远程安装好了MySQL,进入mysql后,有事忘了退出来,当我想起来之后,远程已经断开连接,重新连接ssh,登录MySQL,输入密码提示错误,检查服务:service mysqld status  

[root@localhost ~]# service mysqld status
mysqld 已死,但是 subsys 被锁
[root@localhost ~]#

然后查询下资料,按照以下步骤:

[root@localhost ~]# service mysqld stop
停止 mysqld: [确定]
[root@localhost ~]#


[root@localhost ~]# ps aux|grep mysql
root     13690  0.0  0.0   6764  1420 ?        S    04:10   0:00 /bin/sh /usr/bin/mysqld_safe --user=root --skip-grant-tables
mysql    14708  0.0  0.7 135412 15024 ?        Sl   04:26   0:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=root --skip-grant-tables --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
root     15558  0.0  0.0   6736  1412 pts/1    S    04:49   0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql
mysql    15660  0.0  0.6  80748 11840 pts/1    Sl   04:49   0:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
root     16107  0.0  0.0   5984   764 pts/1    S+   04:51   0:00 grep mysql
[root@localhost ~]#


[root@localhost ~]# 
[root@localhost ~]# kill -9 14708   //杀死mysql进程
[root@localhost ~]#


[root@localhost ~]# ps aux|grep mysql    //mysql进程都关闭了
root     16170  0.0  0.0   5980   756 pts/1    S+   04:53   0:00 grep mysql
[root@localhost ~]# 
[root@localhost ~]# service mysqld status
mysqld 已死,但是 subsys 被锁
[root@localhost ~]#


[root@localhost ~]# service mysqld restart  //重启mysql服务,重新连接
停止 mysqld: [确定]
正在启动 mysqld: [确定]
[root@localhost ~]#


[root@localhost ~]# mysql -u root -p   
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

mysql>                                    //连接成功,进入MySQL
mysql> 
mysql> exit
Bye
[root@localhost ~]#


以下是网上参考资料:

今天在Red Hat Linux 9上面安装了MYSQL,但是在service mysql start以后,查看service mysql status的时候出现以下提示:

mysqld 已死,但是 subsys 被锁

我起初还看了日志文件,日志文件提示:

Cannot initialize InnoDB as ‘innodb_data_file_path‘ is not set.
If you do not want to use transactional InnoDB tables, add a line
skip-innodb
to the [mysqld] section of init parameters in your my.cnf
or my.ini. If you want to use InnoDB tables, add to the [mysqld]
section, for example,
innodb_data_file_path = ibdata1:10M:autoextend
But to get good performance you should adjust for your hardware
the InnoDB startup options listed in section 2 at
060806 12:51:01 /usr/libexec/mysqld: Incorrect information in file: ‘./mysql/host.frm‘
060806 12:51:01 mysqld ended

我把原版的英文发给大家看看:

1. Obviously the ‘ole check the log file for anything nasty

cat /var/log/mysqld.log

2. Stop the service

service mysqld stop

3. Check to see if the service stopped, it might be calling the wrong pid.

ps aux | grep mysql

4. Kill any mysql process that might still be running.

kill -9 ??? ???

5. (*CAREFUL*) Remove/move/backup any databases from the data directory, only do this step if you need to.

rm -Rf /var/lib/mysql/*

6. Check your global options configuration file, should be similar to stevanbt‘s initial post.

cat /etc/my.cnf

7. Copy over one of the preconfigured ‘sample‘ server-specific options file. Global (/etc/my.cnf) file has priority over server-specific file, but these have more options in them and have been tuned for a certain role.

cp /usr/share/doc/mysql-server-?.??.??/my-small.cnf /var/lib/mysql

8. Recreate the initial databases, this step is optional as the initscripts will do this anyway.

mysql_install_db

9. Check and set the runlevels for the service.

chkconfig --level 345 mysqld on
chkconfig --list mysqld

10. Start the service.

service mysqld start

11. Check the log file (step 1)

Thats just a basic step through check, most of you have probably already done this.

其实做到step 9问题都已经解决了。 

centos6.5安装MYSQL“mysqld已死,但是subsys被锁”的解决方案

标签:“mysqld已死   但是subsys被锁”   

原文地址:http://1234x.blog.51cto.com/3884036/1608130

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!