欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

MySQL禁用InnoDB引擎的方法

程序员文章站 2024-02-28 09:29:52
一、确定版本 查看mysql版本复制代码 代码如下:mysql -v或者可以登录mysql使用select version();或status;命令查看 二、开始工作...

一、确定版本

查看mysql版本

复制代码 代码如下:
mysql -v

或者可以登录mysql使用select version();或status;命令查看

二、开始工作

关闭mysql

复制代码 代码如下:

service mysql stop

如果上面的命令无法关闭mysql,则使用kill -9命令强制杀掉进程;

修改mysql配置文件my.cnf(通常位于/etc/mysql/my.cnf)下加入如下字段

对于mysql 5.5而言:

复制代码 代码如下:

default-storage-engine=myisam
loose-skip-innodb

loose-innodb-trx=0
loose-innodb-locks=0
loose-innodb-lock-waits=0
loose-innodb-cmp=0
loose-innodb-cmp-per-index=0
loose-innodb-cmp-per-index-reset=0
loose-innodb-cmp-reset=0
loose-innodb-cmpmem=0
loose-innodb-cmpmem-reset=0
loose-innodb-buffer-page=0
loose-innodb-buffer-page-lru=0
loose-innodb-buffer-pool-stats=0


对于mysql 5.6而言:
复制代码 代码如下:

default-storage-engine=myisam
default-tmp-storage-engine=myisam
loose-skip-innodb

loose-innodb-trx=0
loose-innodb-locks=0
loose-innodb-lock-waits=0
loose-innodb-cmp=0
loose-innodb-cmp-per-index=0
loose-innodb-cmp-per-index-reset=0
loose-innodb-cmp-reset=0
loose-innodb-cmpmem=0
loose-innodb-cmpmem-reset=0
loose-innodb-buffer-page=0
loose-innodb-buffer-page-lru=0
loose-innodb-buffer-pool-stats=0
loose-innodb-metrics=0
loose-innodb-ft-default-stopword=0
loose-innodb-ft-inserted=0
loose-innodb-ft-deleted=0
loose-innodb-ft-being-deleted=0
loose-innodb-ft-config=0
loose-innodb-ft-index-cache=0
loose-innodb-ft-index-table=0
loose-innodb-sys-tables=0
loose-innodb-sys-tablestats=0
loose-innodb-sys-indexes=0
loose-innodb-sys-columns=0
loose-innodb-sys-fields=0
loose-innodb-sys-foreign=0
loose-innodb-sys-foreign-cols=0


三、查看成效

登录mysql

复制代码 代码如下:
mysql -uroot -p你的密码

显示使用的数据库引擎
复制代码 代码如下:

show engines
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| engine             | support | comment                                                        | transactions | xa   | savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| federated          | no      | federated mysql storage engine                                 | null         | null | null       |
| csv                | yes     | csv storage engine                                             | no           | no   | no         |
| mrg_myisam         | yes     | collection of identical myisam tables                          | no           | no   | no         |
| blackhole          | yes     | /dev/null storage engine (anything you write to it disappears) | no           | no   | no         |
| memory             | yes     | hash based, stored in memory, useful for temporary tables      | no           | no   | no         |
| innodb             | no      | supports transactions, row-level locking, and foreign keys     | null         | null | null       |
| archive            | yes     | archive storage engine                                         | no           | no   | no         |
| myisam             | default | myisam storage engine                                          | no           | no   | no         |
| performance_schema | yes     | performance schema                                             | no           | no   | no         |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
9 rows in set (0.00 sec)