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