mysql之[ERROR]InnoDB:Unabletolock.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服务后,这个⽂件⼜会被删除。如果MySQ
L启动异常,就有可能不⽣成这个⽂件,登录的时候就会出现你这个错误。
[root@mysql01 ~]# cd /var/lib/mysql
[root@mysql01 mysql]# ls
autof ib_logfile0 RPM_UPGRADE_MARKER-LAST
binarylog ib_logfile1 performance_schema test
ibdata1 mysql RPM_UPGRADE_HISTORY
[root@mysql01 mysql]#
错误⽇志报错如下:
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/ --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.
unablemysql>
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论