tags:

views:

107

answers:

3

I am using snow leopard mac.

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.inf at /etc/mysql. Is that right?

2) How do I restar 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.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
<plist version="1.0">
<dict>
    <key>KeepAlive</key>
    <true/>
    <key>Label</key>
    <string>com.mysql.mysqld</string>
    <key>Program</key>
    <string>/usr/local/mysql/bin/mysqld_safe</string>
    <key>RunAtLoad</key>
    <true/>
    <key>UserName</key>
    <string>mysql</string>
    <key>WorkingDirectory</key>
    <string>/usr/local/mysql</string>
</dict>
</plist>
A: 

You haven't told us what OS you're on, but the defaults on Debian Linux are:

/etc/init.d/mysql restart

for restart, and the my.cnf file is located at /etc/mysql/my.cnf

Charlie Somerville
I am using snow leopard mac. Sorry I should have mentioned.
Nadal
A: 

1) It possible it doesn't exist. You can create one in /etc/my.cnf or in your datadir (usually /var/lib/mysql or /usr/local/var)

2) I usually use "mysqladmin shutdown" (might need a -p if you have a password set) and then a "sudo mysqld_safe &" to start it up

NeuroScr
+1  A: 

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 &
Keith Randall