mysql启动失败问题汇总
启动失败时最好是查看mysql的错误日志,从配置文件里查看错误日志路径
cat /etc/my.conf
cat /var/mysql/error.log // 默认错误日志路径
报错1:
InnoDB: Error: unable to create temporary file; errno: 13
临时目录无权限,给mysql用户目录权限
chown -R mysql:mysql /tmp/bs/mysql
报错2:
[ERROR] --initialize specified but the data directory has files in it. Aborting.
[ERROR] Aborting
// 详细日志1
mysqld: Table 'mysql.plugin' doesn't exist
[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
// 详细日志2
[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
[ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files.
[ERROR] Aborting
解决方法:
清理data目录,到 my.conf 文件查看 datadir 目录路径
datadir=/home/data/mysql/