MySQL修改 innodb_data_file_path 参数注意事项
mysql 修改 innodb_data_file_path 参数注意事项
说明
在测试环境下没有设置过多的详细参数就初始化并启动了服务,后期优化的过程中发现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错误日志里会报如下错误:
相关推荐
emmm00 2020-11-17
王艺强 2020-11-17
aydh 2020-11-12
世樹 2020-11-11
zry 2020-11-11
URML 2020-11-11
spurity 2020-11-10
yifangs 2020-10-13
Andrea0 2020-09-18
Ida 2020-09-16
ltd00 2020-09-12
tufeiax 2020-09-03
xjd0 2020-09-10
greatboylc 2020-09-10
adsadadaddadasda 2020-09-08
疯狂老司机 2020-09-08
CoderToy 2020-11-16
ribavnu 2020-11-16
bianruifeng 2020-11-16