MySQL-5.7 ___Table 'mysql.plugin' doesn't exist

/ Problem_Solved / 没有评论 / 1434浏览

错误重现

service mysql start
2015-10-23 17:06:33 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-10-23 17:06:33 0 [Note] ./mysqld (mysqld 5.6.27) starting as process 31312 ...
2015-10-23 17:06:33 31312 [Note] Plugin 'FEDERATED' is disabled.
./mysqld: Table 'mysql.plugin' doesn't exist
2015-10-23 17:06:33 31312 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2015-10-23 17:06:33 31312 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-10-23 17:06:33 31312 [Note] InnoDB: The InnoDB memory heap is disabled
2015-10-23 17:06:33 31312 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-10-23 17:06:33 31312 [Note] InnoDB: Memory barrier is not used
2015-10-23 17:06:33 31312 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-10-23 17:06:33 31312 [Note] InnoDB: Using CPU crc32 instructions
2015-10-23 17:06:33 31312 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-10-23 17:06:33 31312 [Note] InnoDB: Completed initialization of buffer pool
2015-10-23 17:06:33 31312 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2015-10-23 17:06:33 31312 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2015-10-23 17:06:33 31312 [Note] InnoDB: Database physically writes the file full: wait...
2015-10-23 17:06:33 31312 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2015-10-23 17:06:34 31312 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2015-10-23 17:06:34 31312 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2015-10-23 17:06:34 31312 [Warning] InnoDB: New log files created, LSN=45781
2015-10-23 17:06:34 31312 [Note] InnoDB: Doublewrite buffer not found: creating new
2015-10-23 17:06:34 31312 [Note] InnoDB: Doublewrite buffer created
2015-10-23 17:06:34 31312 [Note] InnoDB: 128 rollback segment(s) are active.
2015-10-23 17:06:34 31312 [Warning] InnoDB: Creating foreign key constraint system tables.
2015-10-23 17:06:34 31312 [Note] InnoDB: Foreign key constraint system tables created
2015-10-23 17:06:34 31312 [Note] InnoDB: Creating tablespace and datafile system tables.
2015-10-23 17:06:34 31312 [Note] InnoDB: Tablespace and datafile system tables created.
2015-10-23 17:06:34 31312 [Note] InnoDB: Waiting for purge to start
2015-10-23 17:06:34 31312 [Note] InnoDB: 5.6.27 started; log sequence number 0
2015-10-23 17:06:34 31312 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 5bed1721-7965-11e5-a520-000c299a432a.
2015-10-23 17:06:34 31312 [Note] Server hostname (bind-address): '*'; port: 3306
2015-10-23 17:06:34 31312 [Note] IPv6 is available.
2015-10-23 17:06:34 31312 [Note]   - '::' resolves to '::';
2015-10-23 17:06:34 31312 [Note] Server socket created on IP: '::'.
2015-10-23 17:06:34 31312 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist

错误原因

从报错上来看,是由于缺少了mysql.plugin表所致的,直接原因是什么我也没查到,就是我使用zabbix连接mysql,才发现测试站上mysql已经挂掉,然后重启,发现起不来.可能是什么错误操作,导致mysql异常关闭,导致表丢失

解决思路方法

有人说修复表,但是我发现我们修复表的时候,出错了, 然后我想着,要不然把数据备份出来,重新安装一个MySQL? 此刻是周五的晚上1点多

但是我觉得,此种问题,肯定还有其它方法去解决,待日后深究.

还面临一个问题,就是数据库根本起不来!!!

后来在不断的尝试下,发现往配置文件里面加红上跳表的配置,然后重启MySQL竟然可以,好吧,立马导数据,全库导出,导出成功后开始着手重新安装mysql

  1. 配置文件加上跳表配置(skip-grant-tables)
  2. 重启MYSQL
  3. 启动成功后导出数据
  4. 开始重新安装MySQL
  5. 安装成功后导入之前的数据**

End

此刻是凌晨四点多