centos mysql5.6 内存过大开机占用470M innodb使用MYISAM存储引擎 优化到70M使用

数据库教程 2020-06-12 16:03:37 29

导读

安装完后发现,top内存量占用都很大,竟然有47.1%内存使用。我的VPS总共才1G内存,目前只放了个discuz,不需要mysql那么大的内存。一路优化完后只有7.5%占用率了。1、关闭innodb使用MYISAM存储引擎参考:http://docs.oracle.com/cd/E17952...db-turning-off.html2、添加配置(……

安装完后发现,top内存量占用都很大,竟然有47.1%内存使用。

我的VPS总共才1G内存,目前只放了个discuz,不需要mysql那么大的内存。一路优化完后只有7.5%占用率了。

1、关闭innodb使用MYISAM存储引擎

参考:http://docs.oracle.com/cd/E17952 ... db-turning-off.html

2、添加配置(可以先单独尝试这一步,我在不关闭innodb引擎的情况从471M降低到了70M)

performance_schema_max_table_instances=200

table_definition_cache=200

table_open_cache=128

==================================================================================

mysql 重启: /etc/init.d/mysqld restart

/etc/my.cnf配置如下

# For advice on how to change settings please see

http://dev.mysql.com/doc/refman/ ... ation-defaults.html

# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the

# *** default location during install, and will be replaced if you

# *** upgrade to a newer version of MySQL.

[mysqld]

performance_schema_max_table_instances=200

table_definition_cache=200

table_open_cache=128

innodb=OFF

default-storage-engine=MYISAM

default-tmp-storage-engine=MYISAM

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


1253067 TFnetwork_cn