Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing an application that attempts to configure several MySQL servers remotely. Part of this configuration involves setting global mysql variables using SQL syntax like this:


This works well, but it only lasts until the server is restarted. What I would like is a way to make MysQL write these changes to an options (.ini) file, such that they are persistent across machine reboots.

I'm trying to edit the options files without actually opening them directly - I'd prefer to do everything through the MySQL connection.

Does anyone know if this can be done?

share|improve this question

set-variable=var_name=value is the classic method to do this in my.cnf. Also, you can specify using flags as --set-variable=var_name=value. Earlier than MySQL 4.0.2, most configuration options were set using this method.

This is depreciated and even removed in MySQL 5.5. Most options can be set using their actual names in the my.cnf. If you need further help, please be more specific.

share|improve this answer

To make a global system variable setting permanent, you should set it in an option file:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.