Search code examples
mysqlperformancemy.cnfmysqltuner

Mysql my.cnf empty and mysqltuner


I'm trying to solve a performance issue I have on a Mysql database and to do that I'm using mysqltuner. What I don't understand is why in phpmyadmin and mysqltuner I have several variable mentioned, whereas when I open the my.cnf file is almost empty. There is the maxconnections parameter only. Where are stored the other variables ???


Solution

  • Most of what mysqltuner comes from

    SHOW GLOBAL VARIABLES;
    SHOW GLOBAL STATUS;
    

    my.cnf is merely the overrides to the default static VARIABLES built into the server. STATUS are counters, etc that change over time.

    Note the word GLOBAL. Those are the defaults for the corresponding SESSION values that belong to your connection. The VARIABLES you change in phpmyadmin, will not be permanent. You have to edit my.cnf and restart mysqld to get permanent changes.

    Usually you cannot tune your way out of a performance problem. Once you have the main cache size set (which engine are you using? how much ram do you have?), not much other tuning is worth doing.

    The main performance gains are from improving the queries and/or the schema, such as adding composite indexes. Let's see a slow query, and we can discuss this further.