查看数据库开了inodb_linux下 mysql 查看及更改默认数据库引擎

mysql 默认的数据库引擎是MyISAM,不支持事务和外键,也可使用支持事务和外键的InnoDB。

查看当前数据库的所支持的数据库引擎以及默认数据库引擎:

我服务器环境系统为:centos5.3  mysql版本为:5.0.45

mysql> show engines;

+————+———-+——————————————————-                                          ———+

| Engine     | Support  | Comment                                                                                                  |

+————+———-+——————————————————-                                          ———+

| MyISAM     | DEFAULT  | Default engine as of MySQL 3.23 with great performance                                                   |

| MEMORY     | YES      | Hash based, stored in memory, useful for temporary tab                                          les      |

| InnoDB     | DISABLED| Supports transactions, row-level locking, and foreign                                           keys     |

| BerkeleyDB | DISABLED | Supports transactions and page-level locking                                                             |

| BLACKHOLE  | NO       | /dev/null storage engine (anything you write to it dis                                          appears) |

| EXAMPLE    | NO       | Example storage engine                                                                                   |

| ARCHIVE    | NO       | Archive storage engine                                                                                   |

| CSV        | NO       | CSV storage engine                                                                                       |

| ndbcluster | NO       | Clustered, fault-tolerant, memory-based tables                                                           |

| FEDERATED  | NO       | Federated MySQL storage engine                                                                           |

| MRG_MYISAM | YES      | Collection of identical MyISAM tables                                                                    |

| ISAM       | NO       | Obsolete storage engine                                                                                  |

+————+———-+——————————————————-                                          ———+

12 rows in set (0.00 sec)

mysql>

通过上面我们可以发现,默认的数据库引擎是MyISAM ,在support中,显示为YES的为支持,NO为不支持,DEFAULT为默认,DISABLED为关闭,InooDB可以在my.cnf中配置开启:

注释掉my.cnf配置文件中“skip-innodb ”部分,保存重启服务。

再次查看,DISABLED就显示为YES了。

20110929101203.jpg然后在my.cnf中[mysqld] 部分添加代码:

default-storage-engine=InnoDB

重启mysqld,再次show engines 确认。

20110929101458.jpg

数据库引擎默认就更改为InnoDB。

在windows环境中,数据库默认引擎为InnoDB,也可以通过修改my.ini 来定义默认引擎。方法一样。

PS:

在linux中的my.cnf配置文件中有这么一段:

# Uncomment the following if you are using InnoDB tables

#innodb_data_home_dir = /var/lib/mysql/

#innodb_data_file_path = ibdata1:10M:autoextend

#innodb_log_group_home_dir = /var/lib/mysql/

#innodb_log_arch_dir = /var/lib/mysql/

# You can set .._buffer_pool_size up to 50 – 80 %

# of RAM but beware of setting memory usage too high

#innodb_buffer_pool_size = 16M

#innodb_additional_mem_pool_size = 2M

# Set .._log_file_size to 25 % of buffer pool size

#innodb_log_file_size = 5M

#innodb_log_buffer_size = 8M

#innodb_flush_log_at_trx_commit = 1

#innodb_lock_wait_timeout = 50

使用InnoDB引擎的建议取消注释,以优化数据库性能。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值