Linux下MySQL报错:Can't open the mysql.plugin table. Please run mysql_upgrade to create it

Linux新手,刚刚从yum上下完MySQL,启动时却报错:

180720 10:00:54 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
180720 10:00:54  InnoDB: Initializing buffer pool, size = 8.0M
180720 10:00:54  InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242881 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
180720 10:00:54 [ERROR] Plugin 'InnoDB' init function returned error.
180720 10:00:54 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
180720 10:00:54 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

解决办法:

第一种:输入

 mysql_install_db --user=mysql --basedir=/usr/ --ldata=/var/lib/mysql/

再次启动mysql就好了,但是问题没有解决,无法使用InnoDB引擎,想要使用InnoDB引擎请使用第二种方法。
 

第二种:
使用查找文件命令找到ib_logfile0 文件:

find / -name ib_logfile0

跟他在一起还有ib_logfile1文件,你只需要删除这两个文件,或者修改这两个文件名,之后再次启动mysql,就好了。
 

你可能感兴趣的:(Linux)