MySQL修改innodb_data_file_path参数的一些注意事项
作者:moerjinrong 发布时间:2024-01-20 14:32:23
前言
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.
来源:https://www.linuxidc.com/Linux/2019-04/157915.htm
猜你喜欢
- 目录1、互斥锁Mutex1.1 Mutex介绍1.2 Mutex使用实例2、读写锁RWMutex2.1 RWMutex介绍2.2 RWMut
- 简介:网络爬虫(又被称为网页蜘蛛),网络机器人,是一种按照一定的规则,自动地抓信息的程序或者脚本。假设互联网是一张很大的蜘蛛网,每个页面之间
- 系统用户administrator 密码改变后,注销重新登录,发现SQL Server没有随机启动。手动从服务管理器中启动,提示“由于登录失
- UNIX时间戳转换为日期用函数FROM_UNIXTIME()select FROM_UNIXTIME(1156219870);日期
- 本文实例讲述了JS实现获取数组中最大值或最小值功能。分享给大家供大家参考,具体如下:方法一://最小值Array.prototype.min
- 本文实例讲述了Python中函数的参数定义和可变参数用法。分享给大家供大家参考。具体如下:刚学用Python的时候,特别是看一些库的源码时,
- 1.游戏画面1.1开始1.2射击怪物2.涉及知识点1.sprites2.pygame混音器3.图章 4.python
- 一.魔法方法1.属性访问通常可以通过点(.)操作符的形式去访问对象的属性。class C:def __init__(self):self.x
- 问题描述:使用scn号恢复误删数据1.查询系统闪回的scn值以及当前日志的scn值,因为我这个是测试,创建的表是在在后边,所以scn值要大于
- 1.find函数find() 方法检测字符串中是否包含子字符串 str ,如果指定 beg(开始) 和 end(结束) 范围,则检查是否包含
- 很多介绍 根据日志等级打印不同颜色 的文章都是介绍的Ideolog , 但是我个人还是倾向于 Grep Console , 你可以在配置界面
- Analyze Table MySQL 的Optimizer(优化元件)在优化SQL语句时,首先需要收集一些相关信息,其中就包括表的card
- 樂思蜀将SEO工作中所需要的301转向代码进行了整理,收藏并分享,以备查阅。1、IIS下301设置 Internet信息服务管理器 ->
- 使用MySQL,安全问题不能不注意。以下是MySQL提示的23个注意事项:1.如果客户端和服务器端的连接需要跨越并通过不可信任的网络,那么就
- 在做项目的过程中,我们经常会建立各种各样的规范,以方便团队之间更好的合作更好的完成项目;同样我们也经常会听到各种各样的协议,比如Google
- LyScript 可实现自定义汇编指令的替换功能,用户可以自行编写一段汇编指令,将程序 * 定的通用函数进行功能改写与转向操作,此功能原理是简
- 使用一个遵循buffer protocol的对象就可以和numpy交互了.这个buffer_protocol要有哪些东西呢? 要有如下接口:
- 状态模式状态模式,当对象的内部状态发生了改变的时候,允许对象执行不同的流程。优点:封装了状态转换规则。枚举了可能的状态,在枚举状态之前需要确
- 这篇文章主要介绍了Django app配置多个数据库代码实例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需
- 做一个简单WPF连接数据库的控件类型和名称:DataGrid:dataGrid &