Changing a MySQL/MariaDB variable in my.cnf has no effect?

in Development


The MySQL/MariaDB Server settings tweaked in /etc/mysql/my.cnf will go live only after you restart it - but sometimes a simple service mysql restart just won't do it. Instead, try:

service mysql reload
service mysql stop
service mysql start

If there's some e.g. unrelated error in your config, restart will actually do nothing (apparently to ensure the database keeps running) and say nothing, misleading you to think the reload did go through and there's something wrong with your variable syntax. When this happened to me, I spent non-zero time moving skip_name_resolve and skip-name-resolve around my.cnf not being sure about the variable syntax.

However, reload forces the server to reload the config, and spits out explicit warning on error.

To check the current values and make sure they're in effect:

SHOW VARIABLES LIKE 'key_buffer_size';
SHOW VARIABLES LIKE 'skip_name_resolve';
#mysql #debian #mariadb