Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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:

SET GLOBAL VARIABLE foo=123;

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

2 Answers 2

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: http://dev.mysql.com/doc/refman/5.0/en/option-files.html

share|improve this answer

Your Answer

 
discard

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.