mysql 安装时候安装后启动不成功报错:

Starting MySQL.. ERROR! The server quit without updating PID file (/data/mysql/26765574162f.pid).

blob.png


查看报错日志:

[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist

blob.png


解决办法:


1.编辑配置文件:

vim /etc/my.cnf
basedir = /usr/local/mysql
datadir = /data/mysql
socket = /tmp/mysql.sock
log-error = /data/mysql/error.log
pid-file = /data/mysql/mysql.pid
user = mysql
tmpdir = /tmp

2.重新初始化mysql:

./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql --pid-file=/data/mysql/mysql.pid --tmpdir=/tmp

然后再启动就会成功了:

blob.png