ERROR 2002 (HY000)


阿里云服务器一直启动和登录不了:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '' (111 "Connection refused")

用启动数据库的命令service mysql start(注意这个阿里云系统版本的命令,有些系统就不一样)不断启动它,让它将错误写入上述错误日志文件,然后去排查问题。

查看错误日志文件:*********.err


191204 13:37:27 [ERROR] Found 150 prepared transactions! It means that mysqld was not shut down properly last time and critical recovery information (last binlog or tc.log file) was manually deleted after a crash.
You have to start mysqld with --tc-heuristic-recover switch to commit or rollback pending transactions.
191204 13:37:27 [ERROR] Aborting

第一次启动Mysql服务时添加如下参数
--tc-heuristic-recover=rollback
注意:第一次启动之后,将上述参数去掉,再次启动,则可以正常使用。
操作:

(1)service mysql start --tc-heuristic-recover=rollback

(2)service mysql start

就可以了。



删除了庞大的err日志文件后,发现空间并没有释放,需要重新启动服务器才能释放,这样太麻烦了。后来查到,应该是该err日志还被系统后台数据库的进程锁定。所以需要重新启动数据库,service mysql restart。即可。(20191209


innodb_force_recovery强制修复MySQL异常关闭问题



Last update: 2021-07-21|Pageview:193
Research Blog: EC | EC_INFO | EC_WORK |


BypResearch