在CentOS6.4 Linux上面安装MySQL5.7.10版本的数据库,在启动服务时抛出如下错误:
2017-07-09T07:26:50.601399Z 0 [ERROR] InnoDB: The Auto-extending innodb_system data file './ibdata1' is of a different size 640 pages (rounded down to MB) than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages! 2017-07-09T07:26:50.601441Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error 2017-07-09T07:26:51.216779Z 0 [ERROR] Plugin 'InnoDB' init function returned error. 2017-07-09T07:26:51.216882Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 2017-07-09T07:26:51.216922Z 0 [ERROR] Failed to initialize plugins. 2017-07-09T07:26:51.216953Z 0 [ERROR] Aborting
解决办法:
修改/etc/my.cnf配置文件,添加如下配置:
innodb_data_file_path = ibdata1:10M:autoextend
再次,尝试启动MySQL服务器,还是失败。我们可以去查看/var/log/mysqld.log日志文件,存在如下错误信息:
2017-07-09T07:30:03.523929Z 0 [ERROR] Fatal error: mysql.user table is damaged. Please run mysql_upgrade. 2017-07-09T07:30:03.524296Z 0 [ERROR] Aborting
去删除/var/lib/mysql目录下面所有文件,如下:
[root@learn mysql]# ll total 174108 -rw-r-----. 1 mysql mysql 56 Jul 9 15:36 auto.cnf -rw-r-----. 1 mysql mysql 346 Jul 9 15:41 ib_buffer_pool -rw-r-----. 1 mysql mysql 77594624 Jul 9 15:41 ibdata1 -rw-r-----. 1 mysql mysql 50331648 Jul 9 15:41 ib_logfile0 -rw-r-----. 1 mysql mysql 50331648 Jul 9 15:36 ib_logfile1 drwxr-x---. 2 mysql mysql 4096 Jul 9 15:36 mysql drwxr-x---. 2 mysql mysql 4096 Jul 9 15:36 performance_schema drwxr-x---. 2 mysql mysql 12288 Jul 9 15:36 sys [root@learn mysql]# rm -fr *
然后再次去初始化mysql,如下:
[root@learn mysql]# mysqld --initialize --user=mysql
启动mysql,如下:
[root@learn mysql]# service mysqld restart Stopping mysqld: [ OK ] Starting mysqld: [ OK ] [root@learn mysql]#
到这里就成功了!不一定能够帮助到你,但是能给你提供参考。谢谢支持!