今天在编译安装MySQL的时候出现报错,报错信息如下
[root@localhost mysql]# service mysql start
Starting MySQL.. ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid)
查看报错日志信息如下:
140627 11:31:43 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
140627 11:31:43 mysqld_safe mysqld from pid file /usr/local/mysql/data/localhost.localdomain.pid ended
140627 11:32:20 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
/usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist
140627 11:32:21 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
于是Google之,大部分的答案都是:
1. 注释/etc/my.cnf里的skip-federated注释掉即#skip-federated;
2. my.cnf文件配置过高,重新定义其中的参数(根据服务器情况定义);
3. 杀掉mysql_safe和mysqld进程,然后再重启;
4. 当前日志文件过大,超出了my.cnf中定义的大小(默认为64M),删除日志文件再重启;
5. 其他情况,查看日志文件(我的是localhost.localdomain.err,具体因人而异),然后具体分析;
但是,问题还是没有解决!!!卧槽
————————————————华丽的分割线——————————————————————
蓦然间在看这个问题的解决办法的评论中看到了下面的这条命令:重新初始化库
[root@localhost mysql]# /usr/local/mysql/scripts/mysql_install_db --user=mysql
[root@localhost mysql]# service mysqld restart
MySQL server PID file could not be found! [失败]
Starting MySQL.. [确定]
我日,这还真他妈把问题解决了。