linux mysql 5.6 記憶體過大的問題
阿新 • • 發佈:2018-12-20
在linux上安裝5.6版本的mysql後,發現記憶體達到700M,經過一番上網查詢發現下面的設定可以減少記憶體:
[mysqld]
performance_schema_max_table_instances=400
table_definition_cache=400
table_open_cache=256
重啟mysql後記憶體減少到380m,雖然依然很大,也勉強可以使用了。
隨後繼續查資料發現其實mysql的安裝目錄share下就有各種不同需求的my.cnf配置,直接copy過來改名my.cnf就可以使用了
my-huge.cnf This is for a large system with memory of 1G-2G where the system runs mainly. my-innodb-heavy-4G.cnf #DESCR: 4GB RAM, InnoDB only, ACID, few connections, heavy queries. my-large.cnf This is for a large system with memory = 512M where the system runs mainly. my-medium.cnf # This is for a system with little memory (32M - 64M) where MySQL plays # an important part, or systems up to 128M where MySQL is used together with # other programs (such as a web server) my-small.cnf # This is for a system with little memory (<= 64M) where MySQL is only used # from time to time and it's important that the mysqld daemon # doesn't use much resources.
我在之前的基礎上又使用了my-small.cnf的配置,記憶體降到350M,沒有到註釋的64M,估計安裝過程某一步的問題。