Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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?
  • -
share|improve this question
~/.my.cnf should be file .my.cnf inside home of starting user. so e.g. /home/ursitesion/.my.cnf –  frlan Apr 24 at 7:02

1 Answer 1

up vote 1 down vote accepted

~/.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.

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

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.