Oct 10

MySQL – Can’t connect to MySQL server on ’server’

Posted by James Netherton | Friday 10 October 2008 5:10 AM | In MySQL

I’ve just wasted a couple of hours trying to figure out why my mac keeps getting the response “Can’t connect to MySQL server on ’server’” when trying to connect to MySQL on my new vmware Ubuntu setup.

The solution is rather simple!

Open up your MySQL configuration file and find the –bind-address directive. It’s most likely that it’ll be set to 127.0.0.1 which makes MySQL listen for connections only via the loopback IP.

Comment out this line and save the configuration file. Restarting MySQL didn’t seem enough to make this work for me so I had to restart the OS.

Feb 05

MySQL: STOPPING server from pid file

Posted by James Netherton | Tuesday 05 February 2008 17:02 PM | In MySQL

If like me you’re lazy and you don’t want to compile the MySQL source to get it running on your Mac, you may have downloaded the package installer from the MySQL website.

I just spent the last hour or so trying to overcome an error that occurred whenever I tried to start the MySQL server:

Starting mysqld daemon with databases from /usr/local/mysql/data

STOPPING server from pid file /usr/local/mysql/data/mysql.pid

080205 mysqld ended

After digging through a few MySQL forum posts, the problem was related to permissions. MySQL files and directories need to be given ownership under the MySQL user account. The fix is quite simple:

cd /usr/local/mysql

sudo chown -R mysql data

sudo chgrp -R mysql .