Mysql入门Mysql更换MyISAM存储引擎为Innodb的操作记录总结
《Mysql入门Mysql更换MyISAM存储引擎为Innodb的操作记录总结》要点: MYSQL入门一般情况下,mysql会默认提供多种存储引擎,可以通过下面的查看: MYSQL入门1)查看mysql是否安装了innodb插件. MYSQL入门通过下面的命令结果可知,已经安装了innodb插件. MYSQL入门
mysql> show plugins;
+------------+--------+----------------+---------+---------+
| Name | Status | Type | Library | License |
+------------+--------+----------------+---------+---------+
| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |
| partition | ACTIVE | STORAGE ENGINE | NULL | GPL |
| CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |
| InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
+------------+--------+----------------+---------+---------+
7 rows in set (0.00 sec)
MYSQL入门---------------------------------------------------------------------- MYSQL入门2)查看mysql现在已提供什么存储引擎: MYSQL入门
mysql> show engines;
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
| InnoDB | YES | Supports transactions,row-level locking,and foreign keys | YES | YES | YES |
| MEMORY | YES | Hash based,stored in memory,useful for temporary tables | NO | NO | NO |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
5 rows in set (0.00 sec)
MYSQL入门3)查看mysql当前默认的存储引擎: MYSQL入门
mysql> show variables like '%storage_engine%';
+----------------+--------+
| Variable_name | Value |
+----------------+--------+
| storage_engine | MyISAM |
+----------------+--------+
1 row in set (0.00 sec)
MYSQL入门4)看某个表用了什么引擎(在显示结果里参数engine后面的就表示该表当前用的存储引擎): MYSQL入门mysql> show create table 表名; MYSQL入门
mysql> show create table wx_share_log;
+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| wx_share_log | CREATE TABLE `wx_share_log` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '微信分享日志自增ID',`reference_id` int(11) NOT NULL COMMENT '保举的经纪人id',`create_time` datetime NOT NULL COMMENT '创建时间',PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 |
+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
MYSQL入门5)如何将MyISAM库导成INNODB引擎格式的: MYSQL入门在备份出的xxx.sql文件中把ENGINE=MyISAM全换成ENGINE=INNODB MYSQL入门6)转换表的命令: MYSQL入门mysql> alter table 表名 engine=innodb; MYSQL入门有上面可以查到看,本机mysql使用的存储引擎是默认的MyISAN,由于业务必要,先要将其存储引擎改为Innodb. MYSQL入门操作记录如下: MYSQL入门1)以平安模式关闭mysql MYSQL入门[root@dev mysql5.1.57]# mysqladmin -uroot -p shutdown MYSQL入门2)备份my.cnf MYSQL入门[root@dev mysql5.1.57]# cp my.cnf my.cnf.old MYSQL入门3)修改my.cnf配置文件 MYSQL入门[root@dev mysql5.1.57]# vim my.cnf MYSQL入门4)删除/mysql/data目录下的ib_logfile0,ib_logfile1.删除或剪切到别处都行. MYSQL入门[root@dev var]# mv ib_logfile0 ib_logfile1 /tmp/back/ MYSQL入门5)启动mysql,登陆mysql验证存储引擎是否已切换 MYSQL入门[root@dev var]# /Data/app/mysql5.1.57/bin/mysqld_safe --defaults-file=/Data/app/mysql5.1.57/my.cnf & MYSQL入门
mysql> show variables like '%storage_engine%';
+----------------+--------+
| Variable_name | Value |
+----------------+--------+
| storage_engine | InnoDB |
+----------------+--------+
1 row in set (0.00 sec)
MYSQL入门以上这篇Mysql更换MyISAM存储引擎为Innodb的操作记录总结便是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持编程之家PHP. 《Mysql入门Mysql更换MyISAM存储引擎为Innodb的操作记录总结》是否对您有启发,欢迎查看更多与《Mysql入门Mysql更换MyISAM存储引擎为Innodb的操作记录总结》相关教程,学精学透。编程之家 52php.cn为您提供精彩教程。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |