MySQL5.7安装、启动报错解决方法集合

文章目录

  • InnoDB: Server exits.
  • this is incompatible with sql_mode=only_full_group_by
  • 初始化报错

InnoDB: Server exits.

报错详情

2019-11-11T04:36:44.028428Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-11-11T04:36:44.028552Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2019-11-11T04:36:44.028586Z 0 [Note] /usr/local/mysql5.7/bin/mysqld (mysqld 5.7.26) starting as process 2645 ...
2019-11-11T04:36:44.034436Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-11-11T04:36:44.034480Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-11-11T04:36:44.034489Z 0 [Note] InnoDB: Uses event mutexes
2019-11-11T04:36:44.034495Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2019-11-11T04:36:44.034501Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-11-11T04:36:44.034507Z 0 [Note] InnoDB: Using Linux native AIO
2019-11-11T04:36:44.035118Z 0 [Note] InnoDB: Number of pools: 1
2019-11-11T04:36:44.035260Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-11-11T04:36:44.037380Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2019-11-11T04:36:44.047057Z 0 [Note] InnoDB: Completed initialization of buffer pool
2019-11-11T04:36:44.049625Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2019-11-11T04:36:44.062850Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2019-11-11T04:36:44.067094Z 0 [ERROR] InnoDB: Trying to access page number 4294967295 in space 0, space name innodb_system, which is outside the tablespace bounds. Byte offset 0, len 16384, i/o type read. If you get this error at mysqld startup, please check that your my.cnf matches the ibdata files that you have in the MySQL server.
2019-11-11T04:36:44.067117Z 0 [ERROR] InnoDB: Server exits.

解决方法:
参考:

cd /var/lib/mysql #进入mysql库目录
mkdir old #创建一个备份目录
mv ib* old #将ib库移入备份目录
/etc/init.d/mysql start #启动MySQL

this is incompatible with sql_mode=only_full_group_by

报错详情

this is incompatible with sql_mode=only_full_group_by

解决方法:
1、查看当前sql_mode

select @@GLOBAL.sql_mode;

在这里插入图片描述
2、修改配置文件my.cnf,末尾加上该行代码之后,重启MySQL服务。

sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

3、再次查看sql_mode
在这里插入图片描述

初始化报错

启动命令

./mysqld --initialize --user=mysql --basedir=/usr/local/mysql-5.7 --datadir=/usr/local/mysql-5.7/data

报错一:

./mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

解决方法

yum install -y libaio

报错二:

./mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory

解决方法

yum -y install numactl.x86_64

报错三:

2019-06-21T09:17:21.968768Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-06-21T09:17:21.974348Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2019-06-21T09:17:21.974380Z 0 [Note] ./mysqld (mysqld 5.7.26) starting as process 85 ...
2019-06-21T09:17:21.977921Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

2019-06-21T09:17:21.977946Z 0 [ERROR] Aborting

2019-06-21T09:17:21.977963Z 0 [Note] Binlog end
2019-06-21T09:17:21.979436Z 0 [Note] ./mysqld: Shutdown complete

解决方法

通过在命令后面加上--user=root 进行强制使用root账号启动

报错四:

2019-06-21T09:22:43.246267Z 0 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Table 'mysql.plugin' doesn't exist
2019-06-21T09:22:43.259726Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2019-06-21T09:22:43.260023Z 0 [ERROR] Too many arguments (first extra is '–initialize').
2019-06-21T09:22:43.260031Z 0 [Note] Use --verbose --help to get a list of available options!
2019-06-21T09:22:43.260060Z 0 [ERROR] Aborting

解决方法

1、删除 rm -rf /usr/local/mysql-5.7/data/*
2、执行表初始化命令 ./mysql_install_db --user=mysql --basedir=/usr/local/mysql-5.7 --datadir=/usr/local/mysql-5.7/data
3、初始化 ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql-5.7 --datadir=/usr/local/mysql-5.7/data --user=root

你可能感兴趣的:(MySQL)