MySQL 默认引擎是myisam 引擎,有时我们会需要使用innodb引擎,只需要修改一下配置文件 my.cnf 即可。
在 [mysqld] 段中加入如下配置信息
default-storage-engine=Innodb
innodb_data_home_dir = /usr/local/mysql/var ## 即 datadir
innodb_data_file_path = ibdata1:2000M;ibdata2:2000M;ibdata3:2000M;ibdata4:2000M;ibdata5:2000M;ibdata6:100M:autoextend
innodb_log_group_home_dir = /usr/local/mysql/var ## 日志的目录,建议和 datadir 一样
innodb_log_arch_dir = /usr/local/mysql/var ## 归档日志目录,建议同上
innodb_table_locks=0
innodb_buffer_pool_size = 3G ## 可以把这个值设为内存的70%-80%
innodb_additional_mem_pool_size = 16M
innodb_log_file_size = 100M
innodb_log_buffer_size = 8M
innodb_flush_method = O_DIRECT
innodb_flush_log_at_trx_commit = 0
在 [mysqld] 段中加入如下配置信息
default-storage-engine=Innodb
innodb_data_home_dir = /usr/local/mysql/var ## 即 datadir
innodb_data_file_path = ibdata1:2000M;ibdata2:2000M;ibdata3:2000M;ibdata4:2000M;ibdata5:2000M;ibdata6:100M:autoextend
innodb_log_group_home_dir = /usr/local/mysql/var ## 日志的目录,建议和 datadir 一样
innodb_log_arch_dir = /usr/local/mysql/var ## 归档日志目录,建议同上
innodb_table_locks=0
innodb_buffer_pool_size = 3G ## 可以把这个值设为内存的70%-80%
innodb_additional_mem_pool_size = 16M
innodb_log_file_size = 100M
innodb_log_buffer_size = 8M
innodb_flush_method = O_DIRECT
innodb_flush_log_at_trx_commit = 0
编辑回复