2

When I run $ mysqld --verbose --help | less I got information like

Default options are read from the following files in the given order:
/etc/mysql/my.cnf /etc/my.cnf ~/.my.cnf

As per my understanding, At startup, mysql first look for my.cnf within /etc/mysql/my.cnf then within /etc/my.cnf and then finally ~/.my.cnf.

  • Am I correct?
  • Which directory does this mean - ~/.my.cnf?
  • If a variable x has value 100 in /etc/mysql/my.cnf and again the same variable x has value 200 in etc/my.cnf, What value will really apply?
  • -
1
  • ~/.my.cnf should be file .my.cnf inside home of starting user. so e.g. /home/ursitesion/.my.cnf
    – frlan
    Apr 24 '14 at 7:02
1

~/.my.cnf is .my.cnf file in your home directory. The meaning of tilde ~ in unix is current user's home directory.

The values from different configurations are overwritten. So /etc/my.cnf will overwrite was what defined in /etc/mysql/my.cnf, and ~/.my.cnf will overwrite what was in previous files.

7
  • Will ~/.my.cnf affect for all the users or for only that specific user?
    – ursitesion
    Apr 24 '14 at 7:17
  • 1
    only your user of course. Also I think it can only contain settings for the client as far as I remember.
    – nmad
    Apr 24 '14 at 7:18
  • Also, there is no such file in my installation. Even, there are multiple .xyz files are there.
    – ursitesion
    Apr 24 '14 at 7:19
  • Yes because it is not created by default, you need to create it yourself.
    – nmad
    Apr 24 '14 at 7:19
  • Thanks @edvinas. Can you advice about which file mysql read when start?
    – ursitesion
    Apr 24 '14 at 7:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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