修改MySQL默认引擎为innodb
修改MySQL默认引擎为innodb
1、停止mysql服务
# /etc/init.d/mysqld stop
2、备份my.cnf
cd /etc
cp my.cnf my.cnf_bak
3、修改my.cnf
[mysqld] 后加入
# vi my.cnf
default-storage-engine=InnoDB
4、删除/mysql/data目录下的ib_logfile0,ib_logfile1
否则在启动mysql时会遇到下述错误:
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
[ERROR] Unknown/unsupported table type: InnoDB
[ERROR] Aborting
5、启动mysql
# /etc/init.d/mysqld start
Starting MySQL: [ OK ]
6、登录mysql检查修改是否成功
# mysql -u root -p
mysql>show variables like'storage_engine';
+----------------+--------+
| Variable_name | Value |
+----------------+--------+
| storage_engine | InnoDB |
+----------------+--------+