How do you refresh the MySQL configuration file without restarting?

后端 未结 4 948
时光说笑
时光说笑 2020-12-25 11:01

Apache has such a feature, what about MySQL?

Does one exist?

相关标签:
4条回答
  • 2020-12-25 11:15

    Try:

    sudo /etc/init.d/mysql reload
    

    or

    sudo /etc/init.d/mysql force-reload
    

    That should initiate a reload of the configuration. Make sureyour init.d script supports it though, I don't know what version of MySQL/OS you are using?

    My MySQL script contains the following:

    'reload'|'force-reload')
            log_daemon_msg "Reloading MySQL database server" "mysqld"
            $MYADMIN reload
            log_end_msg 0
            ;;
    
    0 讨论(0)
  • 2020-12-25 11:17

    Specific actions you can do from SQL client and you don't need to restart anything:

    SET GLOBAL log = 'ON';
    FLUSH LOGS;
    
    0 讨论(0)
  • 2020-12-25 11:22

    You were so close! The kill -HUP method wasn't working for me either.

    You were calling:

    select @@global.max_connections;
    

    All you needed was to set instead of select:

    set @@global.max_connections = 400;
    

    See:

    http://www.netadmintools.com/art573.html

    http://www.electrictoolbox.com/update-max-connections-mysql/

    0 讨论(0)
  • 2020-12-25 11:22

    Reloading the configuration file (my.cnf) cannot be done without restarting the mysqld server.

    FLUSH LOGS only rotates a few log files.

    SET @@...=... sets it for anyone not yet logged in, but it will go away after the next restart. But that gives a clue... Do the SET, and change my.cnf; that way you are covered. Caveat: Not all settings can be performed via SET.

    New with MySQL 8.0...

    SET PERSIST ... will set the global setting and save it past restarts. Nearly all settings can be adjusted this way.

    0 讨论(0)
提交回复
热议问题