How to restart mysql and where is my.cnf file

I am using a Mac OS X Snow Leopard Apple computer.

I installed MySQL on my machine using the instructions mentioned here . Everything works great. However, I have two questions.

  • Where is my.cnf file? I searched the whole file system and the result is empty. Is it possible that my.cnf not there, and MySQL works with default values. If so, then probably I should create my.cnf in /etc/mysql . It is right?

  • How to restart MySQL server? I know that it starts when I restart my machine. This is what plist looks like. mysqld_safe does not allow restarting the server.

    KeepAlive label com.mysql.mysqld program / USR / local / MySQL / bin / mysqld_safe RunAtLoad UserName MySQL WorkingDirectory / USR / local / MySQL

+6
mysql
source share
3 answers

In the example my.cnf that comes with mysql:

 # You can copy this file to # /etc/my.cnf to set global options, # mysql-data-dir/my.cnf to set server-specific options (in this # installation this directory is /usr/local/mysql/data) or # ~/.my.cnf to set user-specific options. 

On my OS X 10.4 instance, my.cnf is located in /etc/my.cnf.

To restart mysql, use mysqladmin to close it, and then start it again with mysqld_safe:

 /usr/local/mysql/bin/mysqladmin -uroot -p shutdown sudo /usr/local/mysql/bin/mysqld_safe & 
+8
source share

You did not tell us which OS you are on, but by default on Debian Linux:

 /etc/init.d/mysql restart 

to restart, and the my.cnf file is located in /etc/mysql/my.cnf

+2
source share
  • Perhaps this does not exist. You can create it in /etc/my.cnf or in datadir (usually /var/lib/mysql or /usr/local/var ).

  • I usually use mysqladmin shutdown (you may need -p if you have a password), and then sudo mysqld_safe & to start it.

+2
source share

All Articles