What will happen in MySQL if I write a field multiple time with different value in my.cnf file?

I want to configure mysql server by adding some extra fields at the end of my.cnf file. What will happen if I add same field with different values. For example:


I think it will overwrite the old value when it get a new one. That means max_connections=100 in this case. I just want to make sure. A reference will be awesome.


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Server reads the configuration file(s) line(s) from the beginning till the end.

If some setting is found in the line currently processed then the value for this setting is set instead of current one.

So the most last setting line from the configuration file will be apllied. If the setting is present in more than one config file to be loaded then the most last setting from the most last of these files is applied.

If the value for a setting is distinguished as incorrect one then the server may either stay current value unchanged or replace it with adjusted value (default or rounded). This depends on the setting (I don’t know if the rules can be found in RM) and may be found out practically.

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x