mysql之 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11

问题描述:启动MySQL后,出现连接不上,报 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
[root@mysql01 ~]# service mysql start
Starting MySQL [ OK ]
[root@mysql01 ~]# mysql -uroot -poracle
Warning: Using a password on the command line interface can be insecure.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@mysql01 ~]# ll /var/lib/mysql/mysql.sock
ls: cannot access /var/lib/mysql/mysql.sock: No such file or directory
说明:
mysqld.sock是mysql启动以后自动生成的文件,关闭MySQL服务后,这个文件又会被删除。如果MySQL启动异常,就有可能不生成这个文件,登录的时候就会出现你这个错误。
[root@mysql01 ~]# cd /var/lib/mysql
[root@mysql01 mysql]# ls
auto.cnf ib_logfile0 mysql01.err RPM_UPGRADE_MARKER-LAST
binarylog ib_logfile1 performance_schema test
ibdata1 mysql RPM_UPGRADE_HISTORY
[root@mysql01 mysql]# vi mysql01.err
错误日志报错如下:
2017-06-04 04:08:47 2835
2017-06-04 04:08:47 2835 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.

分析:
1、磁盘空间目录不足
2、ibdata1 文件被其他的进程占用
3、 等

解决过程:
1、 -- 查看磁盘空间情况
[root@mysql01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 35G 7.8G 26G 24% /
tmpfs 699M 72K 699M 1% /dev/shm
/dev/sda1 2.9G 4.5M 2.7G 1% /tmp
2、 --InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
已经指出其他的线程启动已经在运行无法再次创建相关的读文件进程的权限,也就是说,现有的ibddata文件已经有人读取了,无法再次启动!
-- 查看系统 mysql 相关进程
[root@mysql01 ~]# ps aux |grep mysql*
root 1742 0.0 0.0 108336 552 ? S 03:59 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/mysql01.pid
mysql 1930 0.2 37.8 1170956 541948 ? Sl 03:59 0:03 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/mysql01.err --pid-file=/var/lib/mysql/mysql01.pid --port=3306
root 3117 0.0 0.0 103312 876 pts/2 S+ 04:29 0:00 grep mysql*
-- kill -9 杀掉
[root@mysql01 ~]# kill -9 1930
[root@mysql01 ~]# ps aux |grep mysql*
root 3186 0.0 0.0 103308 852 pts/2 S+ 04:29 0:00 grep mysql*
-- 启动
[root@mysql01 ~]# service mysql start
Starting MySQL.. [ OK ]
[root@mysql01 ~]# mysql -uroot -poracle
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
说明:恢复正常

posted on 2017-06-03 21:12  张冲andy  阅读(12411)  评论(0编辑  收藏  举报

导航