1. 关闭数据库:
[root@localhost ~]# mysqladmin -uroot -p -S /tmp/mysql.sock shutdown
Enter password:
[root@localhost ~]# ps -elf | grep mysql
0 S root 9735 9708 0 80 0 - 25824 pipe_w 23:08 pts/3 00:00:00 grep mysql
2. 修改配置文件共享表空间的大小。
innodb_data_file_path=ibdata1:300M:autoextend
3. 启动数据库:
InnoDB: Error: auto-extending data file ./ibdata1 is of a different size
InnoDB: 6400 pages (rounded down to MB) than specified in the .cnf file:
InnoDB: initial 19200 pages, max 0 (relevant if non-zero) pages!
在启动的时候报错了, 是因为我动了大小。
这里我把共享表空间的数据文件COPY出去。
mv /data/mysql/mysql_3306/data/ibdata1 /data/mysql/mysql_3306/
再次启动:
140612 23:12:44 InnoDB: Error: all log files must be created at the same time.
140612 23:12:44 InnoDB: All log files must be created also in database creation.
继续报错, 所有日志创建时间也不一致。
将REDO LOG移到另一个目录。
mv /data/mysql/mysql_3306/data/ib_logfile* /data/mysql/mysql_3306/
这里需要同时把共享表空间再移出去, 因为刚刚启动的时候又生成了一次共享表空间, 所以需要再次移出。
mv /data/mysql/mysql_3306/data/ibdata1 /data/mysql/mysql_3306/ibdata1bak
再次启动
[root@localhost bin]# ./mysqld_safe --defaults-file=/etc/my.cnf &
[1] 11923
[root@localhost bin]# 140612 23:16:55 mysqld_safe Logging to '/data/mysql/mysql_3306/data/error.log'.
140612 23:16:55 mysqld_safe Starting mysqld daemon with databases from /data/mysql/mysql_3306/data
启动成功, 下面我们来看一下MYSQL的日志。
140612 23:16:55 InnoDB: Initializing buffer pool, size = 2.0G
140612 23:16:56 InnoDB: Completed initializatio