vi /etc/my.cnf
innodb_data_home_dir =
innodb_data_file_path= /data/mysql/ibdata1:10M:autoextend(为目前ibdata情况)
[root@HE1 mysql]#mkdir -p /data2/mysql
[root@HE1mysql]# chown -R mysql:mysql/data2
[root@HE1 scripts]#du -sh /data/mysql/ibdata1
74M /data/mysql/ibdata1
-rw-rw---- 1 mysqlmysql 77594624 Mar 25 16:21 ibdata1
[root@HE1 mysql]# vi/etc/my.cnf
修改ibdata1为刚刚查出的大小,精确到M,过大或过小起库时都会报错,并添加ibdata2
innodb_data_file_path= /data/mysql/ibdata1:74M;/data2/mysql/ibdata2:10M:autoextend
起库
[root@HE1 mysql]#/etc/init.d/mysqld start
Starting MySQL..SUCCESS!
注:如果ibdata1中的值没有精确计算,调为75M或者更大,亦或者更小,都会导致起库报如下错误:
[root@HE1 mysql]#/etc/init.d/mysqld start
Starting MySQL.ERROR! The server quit without updating PID file (/data/mysql/HE1.pid).
起库后可以看到扩容的ibdata2
[root@HE1 mysql]# cd/data2/mysql/
[root@HE1 mysql]# ll
total 10240
-rw-rw---- 1 mysqlmysql 10485760 Mar 25 16:27 ibdata2
[root@HE1 mysql]# du-sh *
10M ibdata2
原文地址:http://suifu.blog.51cto.com/9167728/1755262