关于mysql innodb
时间:2010-11-22 来源:xjc2694
一、关于innodb:
默认配置 表空间文件在数据目录下 初始10M大小 自动扩展 每次8M
[mysqld]
innodb_data_file_path=ibdata1:10M:autoextend
指定表空间位置:
[mysqld]
innodb_data_home_dir = /ibdata
innodb_data_file_path=ibdata1:50M;ibdata2:50M:autoextend
note: /ibdata 目录事先要创建
等价于:
[mysqld]
innodb_data_home_dir =
innodb_data_file_path=/ibdata/ibdata1:50M;/ibdata/ibdata2:50M:autoextend
指定表空间最大限度500M:
[mysqld]
innodb_data_file_path=ibdata1:10M:autoextend:max:500M
二、查看表的引擎 SHOW TABLE STATUS [FROM db_name] [LIKE 'pattern' | WHERE expr] http://dev.mysql.com/doc/refman/5.1/en/show-table-status.html
三、更改表的引擎 1)查看是否支持inonodb show engines; InnoDB | YES 如果innodb support 为NO,在my.cnf 中查找skip-innodb 如果有这个,请注释掉: #skip-innodb 。
2)service mysqld stop
3)到数据目录下
cd /data/mysql/
删除ibdata1 ibdata2 ib_logfile0 ib_logfile1 ib_logfile2这几个文件
4)加上inndb的配置如
innodb_data_file_path = /ibdata/ibdata1:500M;/ibdata/ibdata2:500M:autoextend:max:3000M
set-variable = innodb_buffer_pool_size=200M
set-variable = innodb_additional_mem_pool_size=200M
set-variable = innodb_log_files_in_group=3
set-variable = innodb_log_file_size=50M
set-variable = innodb_log_buffer_size=50M
innodb_flush_log_at_trx_commit = 1
set-variable = innodb_lock_wait_timeout=50
5)启动数据库
service mysqld start
6)切换表的引擎
alter table tblname ENGINE='InnoDB';
innodb_data_file_path=ibdata1:10M:autoextend
指定表空间位置:
[mysqld]
innodb_data_home_dir = /ibdata
innodb_data_file_path=ibdata1:50M;ibdata2:50M:autoextend
note: /ibdata 目录事先要创建
等价于:
[mysqld]
innodb_data_home_dir =
innodb_data_file_path=/ibdata/ibdata1:50M;/ibdata/ibdata2:50M:autoextend
指定表空间最大限度500M:
[mysqld]
innodb_data_file_path=ibdata1:10M:autoextend:max:500M
二、查看表的引擎 SHOW TABLE STATUS [FROM db_name] [LIKE 'pattern' | WHERE expr] http://dev.mysql.com/doc/refman/5.1/en/show-table-status.html
三、更改表的引擎 1)查看是否支持inonodb show engines; InnoDB | YES 如果innodb support 为NO,在my.cnf 中查找skip-innodb 如果有这个,请注释掉: #skip-innodb 。
2)service mysqld stop
3)到数据目录下
cd /data/mysql/
删除ibdata1 ibdata2 ib_logfile0 ib_logfile1 ib_logfile2这几个文件
4)加上inndb的配置如
innodb_data_file_path = /ibdata/ibdata1:500M;/ibdata/ibdata2:500M:autoextend:max:3000M
set-variable = innodb_buffer_pool_size=200M
set-variable = innodb_additional_mem_pool_size=200M
set-variable = innodb_log_files_in_group=3
set-variable = innodb_log_file_size=50M
set-variable = innodb_log_buffer_size=50M
innodb_flush_log_at_trx_commit = 1
set-variable = innodb_lock_wait_timeout=50
5)启动数据库
service mysqld start
6)切换表的引擎
alter table tblname ENGINE='InnoDB';
相关阅读 更多 +