MySQL启动错误一例 idata1与my.cnf innodb_data_file_path = ibdata1:XX:autoextend不一致造成的错误

MySQL错误日志:
INNOB 启动错误:
错误日志:
120310 22:22:18 mysqld_safe mysqld from pid file /data/db-data/localhost.localdomain.pid ended
120311 01:38:53 mysqld_safe Starting mysqld daemon with databases from /data/db-data
120311  1:38:53 [Warning] You need to use --log-bin to make --binlog-format work.
120311  1:38:53 [Note] Plugin 'FEDERATED' is disabled.
120311  1:38:53 InnoDB: The InnoDB memory heap is disabled
120311  1:38:53 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120311  1:38:53 InnoDB: Compressed tables use zlib 1.2.3
120311  1:38:53 InnoDB: Using Linux native AIO
120311  1:38:53 InnoDB: Initializing buffer pool, size = 3.0G
120311  1:38:53 InnoDB: Completed initialization of buffer pool
InnoDB: Error: auto-extending data file ./ibdata1 is of a different size
InnoDB: 16384 pages (rounded down to MB) than specified in the .cnf file:
InnoDB: initial 32768 pages, max 0 (relevant if non-zero) pages!
120311  1:38:53 InnoDB: Could not open or create data files.
120311  1:38:53 InnoDB: If you tried to add new data files, and it failed here,
120311  1:38:53 InnoDB: you should now edit innodb_data_file_path in my.cnf back
120311  1:38:53 InnoDB: to what it was, and remove the new ibdata files InnoDB created
120311  1:38:53 InnoDB: in this failed attempt. InnoDB only wrote those files full of
120311  1:38:53 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
120311  1:38:53 InnoDB: remove old data files which contain your precious data!
120311  1:38:53 [ERROR] Plugin 'InnoDB' init function returned error.
120311  1:38:53 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
120311  1:38:53 [ERROR] Unknown/unsupported storage engine: InnoDB
120311  1:38:53 [ERROR] Aborting

看红字部分:
大致意思是 my.cnf配置文件中的 ibdata1自动扩展初始化属性与已经存在的innodb表空间 ibdata1不一致

vi  /etc/my.cnf

看到如下:

innodb_data_file_path = ibdata1:512M:autoextend  自动扩展为512M

cd  到 数据库文件目录

 ls ibdata1 -lh

显示为:256M

和共享表空间文件 ibdata1文件不一致,找到 ibdata1大小为256M,InnoDB默认一个page大小为16K也就是1/64 M

  16384 *16K =256M(已经存在的表空间) 或者16384/64=256M  
 
 32768  *16K=512M (即初始化32768个page,大小为512M)  或者 32768/64=512M


如果不知道innodb page页大小的话,可以反推: 256M/ 16384个=256*1024K/ 16384=16k/page

所以修改my.cnf为如下配置即可

innodb_data_file_path = ibdata1: 256M:autoextend

然后重新启动mysql:     service mysql restart即可。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值