How to make MySQL read my.cnf again without restarting? [duplicate]
Is there such a command?开发者_运维知识库
I've modified my.cnf,and I don't want to stop/start MySQL.
As far as I know you have to restart your MySQL Server, but there are some configuration variables that can changed without restarting: dynamic system variables
As far as POSIX goes, SIGHUP (which normally tells a program designed to run in the background after starting to reload its config) flushes privileges. Reference here. That's actually as it should be, if you ran the service in the foreground and got disconnected, you'd probably want that to happen.
That leaves us with SIGUSR(1 or 2) which have been known to crash the service.
In short, make due with the tools provided :) Any time you are dealing with a service that makes use of more than primitive IPC, its a good idea to just re-start the service when you make configuration changes. Lots of running threads need to complete their work, die and be re-born .. yet another race to a mutual exclusive lock would take more time than just re-starting it, considering that every running thread would have to modify its behavior and understanding of its universe in situ. That leads to deadlock, quickly and a zombie parent.
Keep in mind that most RDBMS use their own buffering, which is typically handled by the kernel for most other services. You can't just ask a thread to speak Spanish when it once spoke English, or vice versa, depending on what you changed in the configuration.
At least, not without reincarnating the parent.. hence, just re-start.
Install the RubyGem mysql_manager
(sudo gem install mysql_manager
) and then run the command:
mysql-manager --reload-my-cnf --reload-my-cnf:config /etc/my.cnf --log:level DEBUG
For more options, run mysql-manager --help
.
You might need to specify an alternative --db:dsn
, --db:username
, or --db:password
.
Read more about it here: https://github.com/osterman/mysql_manager
精彩评论