Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I restart mysql and where is my.cnf file

Tags:

mysql

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

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

  1. Where is my.cnf file? I searched the whole file system and result is empty. Is it possible that there is no my.cnf and MySQL works with default values. If yes then probably I should create my.cnf at /etc/mysql. Is that right?

  2. How do I restart the MySQL server ? I know it gets started when I restart my machine. Here is what plist looks like. mysqld_safe does not let me restart server.

    KeepAlive Label com.mysql.mysqld Program /usr/local/mysql/bin/mysqld_safe RunAtLoad UserName mysql WorkingDirectory /usr/local/mysql

like image 595
Nick Vanderbilt Avatar asked Apr 30 '10 10:04

Nick Vanderbilt


1 Answers

From 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 at /etc/my.cnf.

To restart mysql, use mysqladmin to shut it down and then start it up again with mysqld_safe:

/usr/local/mysql/bin/mysqladmin -uroot -p shutdown
sudo /usr/local/mysql/bin/mysqld_safe &
like image 200
Keith Randall Avatar answered Oct 13 '22 00:10

Keith Randall