omg
omg

Reputation: 139862

How do you refresh the MySQL configuration file without restarting?

Apache has such a feature, what about MySQL?

Does one exist?

Upvotes: 47

Views: 133453

Answers (4)

Jonathan Holloway
Jonathan Holloway

Reputation: 63672

Try:

sudo /etc/init.d/mysql reload

or

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

That should initiate a reload of the configuration. Make sure your 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
        ;;

Upvotes: 22

Rick James
Rick James

Reputation: 142288

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.

Upvotes: 12

user6007326
user6007326

Reputation: 21

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

SET GLOBAL log = 'ON';
FLUSH LOGS;

Upvotes: 2

mixonic
mixonic

Reputation: 2703

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/

Upvotes: 28

Related Questions