MySQL Daemon Lock issue(MySQL守护进程锁问题)
问题描述
昨晚,我的 MySQL 服务器意外宕机.在尝试重新启动时(使用 service mysql restart - 我是 root)它只是挂起.使用 mysql -u root -p 命令,我得到:
Last night, my MySQL server went down unexpectedly. On attempting to restart (with service mysql restart - I'm root) it merely hangs. With the mysql -u root -p command, I get:
ERROR 2002 (HY000): 无法通过 socket '/var/run/mysqld/mysqld.sock' (2) 连接到本地 MySQL 服务器.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2).
然后我尝试手动启动守护进程(mysqld).提示将挂起约 2 秒钟,然后返回.在仔细检查错误日志后,我得到:
I then tried to start the daemon manually (mysqld). The prompt would hang for about 2 seconds, and then return. On closer inspection of the error logs, I got:
2016-01-22T19:18:32.399584Z 0 [ERROR] 无法创建 unix socket 锁文件/var/run/mysqld/mysqld.sock.lock.
2016-01-22T19:18:32.399622Z 0 [ERROR] 无法设置 unix socket 锁定文件.
2016-01-22T19:18:32.399646Z 0 [错误] 中止
然后我尝试了 chown mysql/var/run/mysqld、chmod -R 775/var/run/mysqld 和 apt-get install mysql-community-server --reinstall.没有运气.
I then tried chown mysql /var/run/mysqld, chmod -R 775 /var/run/mysqld and apt-get install mysql-community-server --reinstall. No luck.
我环顾四周,找不到解决方案.有什么帮助吗?
I have looked around, and couldn't find a solution. Any help here?
注意:我正在使用 MySQL 社区服务器 5.7.10 运行 Debian 8 (Jessie)
Note: I am Running Debian 8 (Jessie) with MySQL community Server 5.7.10
推荐答案
已修复.在[mysqld]下的my.cnf中添加skip-external-locking,然后重启整个系统.对于任何发现此问题的人,这应该可以解决它.此外,如果您备份了数据,然后尝试恢复并被告知 rm ib* 使其工作,则您需要 ibdata 文件.
Fixed. Add skip-external-locking to my.cnf under the [mysqld] section, and then reboot the entire system. This should fix it, for anyone who finds this. Also if you backed up your data, then attempted to restore and were told to rm ib* to make it work, you need the ibdata file.
这篇关于MySQL守护进程锁问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MySQL守护进程锁问题
基础教程推荐
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- 带更新的 sqlite CTE 2022-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
