Reducing memory consumption of mysql on ubuntu@aws micro instance

前端 未结 4 672
-上瘾入骨i
-上瘾入骨i 2021-01-30 03:13

I have recently started on a PoC project wherein we are developing a small web app. The initial setup is done on a micro instance from AWS. We are on rails+mysql stack.

4条回答
  •  孤独总比滥情好
    2021-01-30 03:46

    In your /etc/my.cnf file:

    performance_schema = 0
    

    And restart MySQL. This should chop memory usage dramatically if you previously had it on.


    Edit: For MySQL versions between 5.7.8 and 8.0.1 (not required from 8.0.1 onwards), the above is not enough to free your memory of performance schema data:

    As of MySQL 5.7.8, even when the Performance Schema is disabled, it continues to populate the global_variables, session_variables, global_status, and session_status tables.

    (source)

    To prevent this behaviour, set show_compatibility_56 to 1 in addition to performance_schema. That is to say, your my.cnf changes should look like:

    performance_schema = 0
    show_compatibility_56 = 1
    

提交回复
热议问题