前言

innodb_data_file_path用来指定innodb tablespace文件,如果我们不在My.cnf文件中指定innodb_data_home_dir和innodb_data_file_path那么默认会在datadir目录下创建ibdata1 作为innodb tablespace。

说明

在测试环境下没有设置过多的详细参数就初始化并启动了服务,后期优化的过程中发现innodb_data_file_path设置过小:

root@node1 14:59: [(none)]> show variables like '%innodb_data_file_path%';

+-----------------------+------------------------+

| Variable_name | Value |

+-----------------------+------------------------+

| innodb_data_file_path | ibdata1:12M:autoextend |

+-----------------------+------------------------+

1 row in set (0.00 sec)

root@node1 14:59: [(none)]>

当没有配置innodb_data_file_path时,默认innodb_data_file_path = ibdata1:12M:autoextend

[mysqld]

innodb_data_file_path = ibdata1:12M:autoextend

当需要改为1G时,不能直接在配置文件把 ibdata1 改为 1G ,

[mysqld]

innodb_data_file_path = ibdata1:1G:autoextend

否则启动服务之后,从错误日志看到如下报错:

2019-03-29T06:47:32.044316Z 0 [ERROR] InnoDB: The Auto-extending innodb_system data file './ibdata1' is of a different size 768 pages (rounded down to MB) than specified in the .cnf file: initial 65536 pages, max 0 (relevant if non-zero) pages!

大致意思就是ibdata1的大小不是 65536page*16KB/1024KB=1G,而是 786page*16KB/1024KB=12M

(未使用压缩页)

方法一:推荐

而应该再添加一个 ibdata2:1G ,如下:

[mysqld]

innodb_data_file_path = ibdata1:12M;ibdata2:1G:autoextend

重启数据库!

方法二:不推荐

直接改为如下的话

[mysqld]

innodb_data_file_path = ibdata1:1G:autoextend

可以删除$mysql_datadir目录下 ibdata1、ib_logfile0、ib_logfile1 文件:

rm -f ibdata* ib_logfile*

也可以启动MySQL,但是mysql错误日志里会报如下错误:

2019-03-29T07:10:47.844560Z 0 [Warning] Could not increase number of max_open_files to more than 5000 (request: 65535)

2019-03-29T07:10:47.844686Z 0 [Warning] Changed limits: table_open_cache: 1983 (requested 2000)

2019-03-29T07:10:48.028262Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.

2019-03-29T07:10:48.147653Z 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 http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue.

mysqld: Table 'mysql.plugin' doesn't exist

2019-03-29T07:10:48.147775Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

2019-03-29T07:10:48.163444Z 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 http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue.

mysqld: Table 'mysql.gtid_executed' doesn't exist

2019-03-29T07:10:48.163502Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

2019-03-29T07:10:48.163658Z 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 http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue.

mysqld: Table 'mysql.gtid_executed' doesn't exist

2019-03-29T07:10:48.163711Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

2019-03-29T07:10:48.164619Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key

2019-03-29T07:10:48.166805Z 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 http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue.

2019-03-29T07:10:48.166891Z 0 [Warning] Failed to open optimizer cost constant tables

2019-03-29T07:10:48.168072Z 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 http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue.

2019-03-29T07:10:48.168165Z 0 [Warning] Can't open and lock time zone table: Table 'mysql.time_zone_leap_second' doesn't exist trying to live without them

2019-03-29T07:10:48.169454Z 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 http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue.

2019-03-29T07:10:48.169527Z 0 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist

2019-03-29T07:10:48.170042Z 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 http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue.

2019-03-29T07:10:48.170617Z 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 http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue.

2019-03-29T07:10:48.170946Z 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 http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue.

2019-03-29T07:10:48.171046Z 0 [Warning] Info table is not ready to be used. Table 'mysql.slave_master_info' cannot be opened.

2019-03-29T07:10:48.171272Z 0 [Warning] InnoDB: Cannot open table mysql/slave_worker_info from the internal data dictionary of InnoDB though the .frm file for the table exists. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue.

2019-03-29T07:10:48.171626Z 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 http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue.

2019-03-29T07:10:48.171688Z 0 [Warning] Info table is not ready to be used. Table 'mysql.slave_relay_log_info' cannot be opened.

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对脚本之家的支持。

mysql innodb_data_file_path_MySQL修改innodb_data_file_path参数的一些注意事项相关推荐

  1. mysql innodbuffer修改_mysql参数之innodb_buffer_pool_size大小设置

    MYSQL无法启动报错日志,如下: 190801 11:24:29 mysqld_safe mysqld from pid file /var/run/mysql/mysql.pid ended 19 ...

  2. innodb_data_file_path参数的一些注意事项

    innodb_data_file_path用来指定innodb tablespace文件,如果我们不在My.cnf文件中指定innodb_data_home_dir和innodb_data_file_ ...

  3. mysql主从修改系统参数步骤_mysql主从配置的参数配置与步骤_MySQL

    mysql主从配置的参数配置与步骤_MySQL 主从配置的步骤: 在主库建立要同步的数据库,建立主库的帐号和修改主备库配置 create database web default character ...

  4. 转载 小知识:MySQL修改lower_case_table_names参数

    环境:MySQL 5.7.25 起初创建环境时没有要求表名称不区分大小写,后续应用使用提出要设置lower_case_table_names=1的需求,期望表名不再区分大小写. 修改这个参数需要重启实 ...

  5. MySQL性能优化之参数配置

    1.目的: 通过根据服务器目前状况,修改MySQL的系统参数,达到合理利用服务器现有资源,最大合理的提高MySQL性能. 2.服务器参数: 32G内存.4个CPU,每个CPU 8核. 3.MySQL目 ...

  6. MySQL 5.7数据库参数优化

    MySQL 5.7数据库参数优化 连接相关参数 max_connections:允许客户端并发连接的最大数量,默认值是151,一般将该参数设置为500-2000 max_connect_errors: ...

  7. Mysql 配置文件 my.cnf 参数详情参考

    Mysql 配置文件 my.cnf 参数详情参考 参考地址:https://blog.csdn.net/qq_42768234/article/details/110089078 其中有些参数有待查询 ...

  8. MySQL性能优化之参数配置 - 愤怒的码农 - 博客园

    MySQL性能优化之参数配置 1.目的: 通过根据服务器目前状况,修改Mysql的系统参数,达到合理利用服务器现有资源,最大合理的提高MySQL性能. 2.服务器参数: 32G内存.4个CPU,每个C ...

  9. mysql innodb_data_file_path_关于innodb_data_file_path设置

    关于innodb_data_file_path设置 启动Mysql时报错,无法正常启动,通过日志发有数据文件大小错误,日志如下截图: [ERROR] InnoDB: auto-extending da ...

最新文章

  1. nginx虚拟目录配置
  2. 推荐系统中使用ctr排序的f(x)的设计-传统模型篇
  3. linux 别名设置
  4. mysql安装运行(centos)
  5. 阶段3 2.Spring_07.银行转账案例_4 编写事务管理工具类并分析连接和线程解绑
  6. flutter环境配置详解及开发第一个项目
  7. 芯原的神经网络处理器IP获百余款人工智能芯片采用
  8. Dart语言入门(一)
  9. 2020年最新Java后端学习路线,适用于所有Java初学者!
  10. 分布式系统可观测性之应用业务指标监控
  11. 在Qt中配置海康工业相机SDK及遇到的问题(报错)
  12. js限制input的输入字符的长度,区分中英文
  13. 7-2 单位年会聚餐时的座次C位
  14. 请教ip routing指令与no switchport区别?
  15. C语言——关于位段的理解
  16. 使用Dubbo实现简单的RPC调用(Spring配置文件版)
  17. maven编译jar包时打一个瘦包,依赖包和配置文件到jar包外面
  18. 2021 小米前端秋招笔试题
  19. micros swarm framework相关
  20. 在ThinkPad X280加装M.2硬盘上安装 Ubuntu 18.04.3 填坑记录

热门文章

  1. redis缓存清除策略 、获取dumb.rdb或者***.aof文件的位置
  2. Spring注解之@Import用法解析
  3. python实现多表格合并_python 如何把两个表格数据,合并为一个呢?
  4. C# 操作Sqlite
  5. 分析maven依赖导入失败原因
  6. bat 调用class文件_【Java视频教程】day42-??什么是Class???
  7. CUDA学习(三十六)
  8. KVM虚拟化安装配置(一)
  9. 关于linux系统端口查看和占用的解决方案
  10. Java:应用Observer接口实现Observer模式