Site Overlay

MySQL 启动卡在“systemctl start mysql.service”的解决

今天登上我那年久失修的辣鸡腾讯云服务器。然后果然数据库密码忘了,由于服务器上没一个网站,所以也找不回密码。于是一番操作之后要启动 mysql。

➜  systemctl start mysql.service  
^C

彻底卡住了。

重启当然试了,没有用。

参考了网页:

https://serverfault.com/questions/345951/cant-restart-mysql/345958

https://stackoverflow.com/questions/40997257/mysql-service-fails-to-start-hangs-up-timeout-ubuntu-mariadb

https://bugs.launchpad.net/ubuntu/+source/mysql-5.1/+bug/932021

https://dba.stackexchange.com/questions/119367/mysql-hangs-with-nothing-in-error-log

https://askubuntu.com/questions/455029/mysql-server-start-failed

https://forums.mysql.com/read.php?73,677115

全部没有用。

果然还是要靠自己。一番摸索找到一个日志文件“/var/log/mysqld/mysqld.log”

200310 21:01:14 mysqld_safe Logging to '/var/log/mysqld/mysqld.log'.
200310 21:01:14 mysqld_safe Starting mysqld daemon with databases from /data/mysql
2020-03-10 21:01:14 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-03-10 21:01:14 0 [Note] /usr/sbin/mysqld (mysqld 5.6.47-log) starting as process 22716 ...
/usr/sbin/mysqld: File './mysql-bin.index' not found (Errcode: 13 - Permission denied)
2020-03-10 21:01:14 22716 [ERROR] Aborting

2020-03-10 21:01:14 22716 [Note] Binlog end
2020-03-10 21:01:14 22716 [Note] /usr/sbin/mysqld: Shutdown complete

200310 21:01:14 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

关键 " File './mysql-bin.index' not found (Errcode: 13 - Permission denied)"

这么一看就好办了, 执行

touch /usr/sbin/mysql-bin.index
chown mysql /usr/sbin/mysql-bin.index

问题解决.

发表评论

电子邮件地址不会被公开。 必填项已用*标注