shell> mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) shell> service mysqld restart Stopping mysqld: [ OK ] MySQL Daemon failed to start. Starting mysqld: [FAILED] #日志中报错如下: [ERROR] Fatal error: mysql.user table is damaged. Please run mysql_upgrade. [ERROR] Aborting #这种情况本人是在MySQL5.1到5.7版本升级时遇到的,升级到5.7后,数据库启动失败 #解决的办法就是重新初始化数据库 shell> rm -fr /var/lib/mysql shell> mysqld --initialize --user=mysql shell> service mysqld restart Stopping mysqld: [ OK ] Starting mysqld: [ OK ]
mysql-files文件问题
1 2 3 4 5 6 7 8 9 10
#MySQL启动失败,日志中报错如下: [ERROR] Failed to access directory for --secure-file-priv. Please make sure that directory exists and is accessible by MySQL Server. Supplied value : /var/lib/mysql-files
#造成这种情况可能是因为mysql-files文件夹不存在或权限错误 #解决办法如下: shell> touch /var/lib/mysql-files shell> chown mysql:mysql /var/lib/mysql-files shell> service mysqld restart Stopping mysqld: [ OK ] Starting mysqld: [ OK ]