mysql5.7安装过程中,初始化的问题
初始化不指定参数⽂件,如使⽤以下命令初始化:
./mysqld --initialize --user=mysql --basedir=/data/mysql/barry_mysql --datadir=/data/mysql/barry_mysql/data
初始化后 ibdata1⽂件⼤⼩是默认的12M,如果参数⽂件中指定的是1G,则启动报如下错误。
2017-07-27T03:16:41.916500Z mysqld_safe Logging to'/data/mysql/barry_mysql/'.
mysql下载后的初次使用
2017-07-27T03:16:42.001140Z mysqld_safe Starting mysqld daemon with databases from/data/mysql/barry_mysql/data
2017-07-27T03:16:42.158846Z 0[Warning]'NO_AUTO_CREATE_USER' sql mode was not set.
2017-07-27T03:16:42.462038Z 0[ERROR] InnoDB: The Auto-extending innodb_system data file'/data/mysql/barry_mysql/data/ibdata1'is of a different size 768 pages (rounded down to MB) than specified in the f file: initial 65536
2017-07-27T03:16:42.462105Z 0[ERROR] InnoDB: Plugin initialization aborted with error Generic error
2017-07-27T03:16:43.563231Z 0[ERROR] Plugin 'InnoDB' init function returned error.
2017-07-27T03:16:43.563302Z 0[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-07-27T03:16:43.563323Z 0[ERROR] Failed to initialize plugins.
2017-07-27T03:16:43.563338Z 0[ERROR] Aborting
2017-07-27T03:16:43.626546Z mysqld_safe mysqld from pid file/data/mysql/barry_mysql/tmp/mysql.pid ended
如果修改参数⽂件为12M,则可以正常启动。
如果不修改参数⽂件,⽽是将ibdata1删除,起动后会重新⽣成个1G的ibdata1,那么启动会报如下错误,且报错的⼏个表不能正常查看。
2017-07-27T03:41:16.224833Z 0[Warning] InnoDB: New log files created, LSN=45791
mysqld: Table'mysql.plugin' doesn't exist
mysqld: Table 'id_executed' doesn't exist
2017-07-27T03:41:16.371369Z 0[Warning] Gtid table is not ready to be used. id_executed' cannot be opened.
2017-07-27T03:41:16.413614Z 0[Warning] CA certificate ca.pem is self signed.
2017-07-27T03:38:27.049543Z 3[Warning]'proxies_priv' entry '@ root@localhost' ignored in--skip-name-resolve mode.
2017-07-27T03:38:27.050140Z 3[Warning]'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in--skip-name-resolve mode.
2017-07-27T03:40:01.619183Z mysqld_safe mysqld from pid file/data/mysql/barry_mysql/tmp/mysql.pid ended
2017-07-27T03:41:04.955142Z mysqld_safe Logging to'/data/mysql/barry_mysql/'.
2017-07-27T03:41:05.040377Z mysqld_safe Starting mysqld daemon with databases from/data/mysql/barry_mysql/data
2017-07-27T03:41:05.190872Z 0[Warning]'NO_AUTO_CREATE_USER' sql mode was not set.
1002003004005006007008009001000
1002003004005006007008009001000
1002003004005006007008009001000
1002003004005006007008009001000
2017-07-27T03:41:16.224833Z 0[Warning] InnoDB: New log files created, LSN=45791
2017-07-27T03:41:16.275795Z 0[Warning] InnoDB: Creating foreign key constraint system tables.
2017-07-27T03:41:16.366508Z 0[Warning] InnoDB: Cannot open table mysql/plugin from the internal data dictionary of InnoDB though the .frm file for the table exists. Please refer to sql/doc/refman/5.7/en/innodb-troubleshooting mysqld: Table'mysql.plugin' doesn't exist
2017-07-27T03:41:16.366637Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2017-07-27T03:41:16.371317Z 0[Warning] InnoDB: Cannot open table mysql/gtid_executed from the internal data dictionary of InnoDB though the .frm file for the table exists. Please refer to sql/doc/refman/5.7/en/
mysqld: id_executed' doesn't exist
2017-07-27T03:41:16.371369Z 0 [Warning] Gtid table is not ready to be used. Table 'id_executed' cannot be opened.
2017-07-27T03:41:16.413614Z 0 [Warning] CA certificate ca.pem is self signed.
2017-07-27T03:41:16.415576Z 0 [Warning] InnoDB: Cannot open table mysql/server_cost from the internal data dictionary of InnoDB though the .frm file for the table exists. Please refer to sql/doc/refman/5.7/en/innodb-troublesh 2017-07-27T03:41:16.415629Z 0 [Warning] Failed to open optimizer cost constant tables
2017-07-27T03:41:16.416613Z 0 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2017-07-27T03:41:16.416702Z 0 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-
resolve mode.
2017-07-27T03:41:16.416761Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2017-07-27T03:41:16.416792Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2017-07-27T03:41:16.416986Z 0 [Warning] InnoDB: Cannot open table mysql/time_zone_leap_second from the internal data dictionary of InnoDB though the .frm file for the table exists. Please refer to sql/doc/refman/5.7/en/inno 2017-07-27T03:41:16.417023Z 0 [Warning] Can't open and lock time zone table: Table'mysql.time_zone_leap_second' doesn't exist trying to live without them
2017-07-27T03:41:16.417647Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
2017-07-27T03:41:16.417846Z 0 [Warning] InnoDB: Cannot open table mysql/servers from the internal data dictionary of InnoDB though the .frm file for the table exists. Please refer to dev.m
ysql/doc/refman/5.7/en/innodb-troubleshooti 2017-07-27T03:41:16.417874Z 0 [ERROR] Can't open and lock privilege tables: Table'mysql.servers' doesn't exist
2017-07-27T03:41:16.418373Z 0 [Warning] InnoDB: Cannot open table mysql/slave_master_info from the internal data dictionary of InnoDB though the .frm file for the table exists. Please refer to sql/doc/refman/5.7/en/innodb-tro 2017-07-27T03:41:16.418579Z 0 [Warning] InnoDB: Cannot open table mysql/slave_relay_log_info from the internal data dictionary of InnoDB though the .frm file for the table exists. Please refer to sql/doc/refman/5.7/en/innodb-2017-07-27T03:41:16.418763Z 0 [Warning] InnoDB: Cannot open table mysql/slave_master_info from the internal data dictionary of InnoDB though the .frm file for the table exists. Please refer to sql/doc/refman/5.7/en/innodb-tro 2017-07-27T03:41:16.418798Z 0 [Warning] Info table is not ready to be used. Table 'mysql.slave_master_info' cannot be opened.
2017-07-27T03:41:16.418819Z 0 [ERROR] Error in checking mysql.slave_master_info repository info type of TABLE.
2017-07-27T03:41:16.418833Z 0 [ERROR] Error creating master info: Error checking repositories.
2017-07-27T03:41:16.418842Z 0 [ERROR] Failed to create or recover replication info repository.
2017-07-27T03:41:16.418857Z 0 [ERROR] Failed to create or recover replication info repositories.
根据以上实验总结:
(1) 初始化的时候应该指定参数⽂件,这样ibdata1就是⾃⼰设定的1G
  ./bin/mysqld --defaults-file=/data/mysql/barry_mysql/etc/myf --initialize-insecure --user=mysql
(2) ibdata1初始化后不能删除,靠重启⽣成的ibdata1不可⽤。因为⾥⾯保存了系统表的数据。

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。