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

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

[[email protected] ~]# service mysqld status
mysqld 已死,但是 subsys 被锁
[[email protected] ~]#

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

[[email protected] ~]# service mysqld stop
停止 mysqld: [确定]
[[email protected] ~]#
[[email protected] ~]# 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
[[email protected] ~]#
[[email protected] ~]# 
[[email protected] ~]# kill -9 14708   //杀死mysql进程
[[email protected] ~]#
[[email protected] ~]# ps aux|grep mysql    //mysql进程都关闭了
root     16170  0.0  0.0   5980   756 pts/1    S+   04:53   0:00 grep mysql
[[email protected] ~]# 
[[email protected] ~]# service mysqld status
mysqld 已死,但是 subsys 被锁
[[email protected] ~]#
[[email protected] ~]# service mysqld restart  //重启mysql服务,重新连接
停止 mysqld: [确定]
正在启动 mysqld: [确定]
[[email protected] ~]#
[[email protected] ~]# 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
[[email protected] ~]#

以下是网上参考资料:

今天在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问题都已经解决了。

时间: 2024-08-10 21:29:46

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

CentOS6.5安装MySql、Apache、PHP

一.安装MySql 1.卸载CentOS自带的MySql 获取root权限先,卸载CentOS自带的MySql yum remove mysql 2.安装cmake 下载cmake wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz 安装 cd cmake-2.8.5 ./configure --prefix=/usr/local/cmake make make install 3.安装MySql 下载mysql.tar.gz包,这里用

阿里云服务器CentOS6.9安装Mysql

上篇讲了CentOS6.9安装tomcat,这篇来讲mysql的安装 1.查看CentOS是否安装了MySQL yum list installed | grep mysql //查看CentOS是否安装了MySQL 2.如果安装过,先把原来的MySQL删除,删除方法参照:http://blog.csdn.net/zhang41228/article/details/75570976 3.先查看yum库中的mysql yum list | grep mysql //查看yum库中的mysql 4

CentOS6下安装MySQL数据库服务

大家好,今天是我在51CTO上的第一篇博文,以此来督促我自个养成一个好的学习习惯,也希望给大家有所帮助. ok,言归正传,今天我介绍的是在CentOS6环境下安装MySQL数据库,我所用到的是CentOS6镜像文件中所带的mysql包. 1.配置本地yum源. [[email protected] ~]# cd /etc/yum.repos.d/ [[email protected] yum.repos.d]# ls CentOS-Base.repo.bak  CentOS-Debuginfo.

centos6.5安装mysql

2013年10月,MySQL开发团队正式宣布支持Yum仓库,这就意味着我们现在可以从这个Yum库中获得最新和最优版的MySQL安装包.本文将在一台全新安装的CentOS6上安装MySQL5.6,如果你不熟悉MySQL5.6的新特性,我建议从MySQL 5.6的新特性开始,其中有很多非常有用的特性. 首先我们需要从MySQL开发者网站下载Yum仓库文件,导入Yum库后,一个简单的yumupdate命令将确保你运行在MySQL5.6的最新发布版 上,包括一些安全特性的更新.Yum同时也将确保导入相关

CentOS6.5安装MySQL及完全卸载

原文地址:http://www.cnblogs.com/zhongshengzhen/ 第1步.yum安装mysql [[email protected] ~]# yum -y install mysql-server 第2步.设置开机启动 [[email protected] ~]# chkconfig mysqld on 第3步.启动MySql服务 [[email protected] ~]# service mysqld start 第4步.设置MySQL的root用户设置密码 [[ema

centos6.5 安装mysql

在centos6.5上通过yum安装mysql: 1. yum list |grep mysql   (查看版本) 2.安装mysql yum install -y mysql-server mysql mysql-devel 3.查看mysql版本 rpm -qi mysql-server 4.启动mysql service mysqld start 第一次启动输出信息较多: 5.重启: service mysqld restart

CentOS6.6安装MYSQL

两种安装MYSQL的方法 一.免编译安装 1.首先找个目录比如opt这种目录下载mysql安装包: [[email protected] ~]# cd /opt 2.进去后,使用wget或者winscp.rz各种办法把tar包搞进目录下. [[email protected] opt]# wget http://syslab.comsenz.com/downloads/linux/mysql-5.1.40-linux-x86_64-icc-glibc23.tar.gz 下载完之后,就会看到tar

阿里云主机 CentOS6.5 安装Mysql php Apache

真正的勇士感觉面对操蛋的人生.之前申请了一个香港的虚拟主机,各种问题各种慢,有时候就无缘无故的打不开了,中途还经历了一次他们更换服务器,还好我有网站备份,要不我只能蹲在墙角哭了.最近在做微信的开发,咱们也与时俱进一把,使用一下thinkphp的3.2版本!刚想愉快的搞一把,what?告诉我php版本小于5.3.0?什么鬼?看了看thinkphp的入口文件,大大的写着下面这句! // 检测PHP环境 if(version_compare(PHP_VERSION,'5.3.0','<')) die(

36. CentOS-6.3安装Mysql集群

安装要求 安装环境:CentOS-6.3安装方式:源码编译安装 软件名称:mysql-cluster-gpl-7.2.6-linux2.6-x86_64.tar.gz下载地址:http://mysql.mirror.kangaroot.net/Downloads/软件安装位置:/usr/local/mysql数据存放位置:/var/mysql/data日志存放位置:/var/mysql/logs 集群设计 首先设计集群的安装分配方式,我共需要5台服务器,服务器分配如下: 管理节点:    192