By default, MySQL will initialize a large memory block to cache database query data.
But my small host only has 640MB of memory. Top query found that he ate 30% of my total memory, almost 200MB.
But there are only a few MB of data in this database. I feel that this setting is unreasonable.
After crawling, the memory usage is reduced to 128MB
Modify / etc / MySQL directly/ mysql.conf .d/ mysqld.cnf
Add the following configuration at the end of configuration
performance_schema_max_table_instances=150 table_definition_cache=150 table_open_cache=64
Then service MySQL restart can restart the service
The above is the whole content of this article, I hope to help you learn, and I hope you can support developer more.