Can't connect to MySQL server on OS X Server

Can't connect to MySQL server on OS X Server

by Julian Clementson -
Number of replies: 2
Looking forward to getting this running on our OS X Server, but I'm getting this error when accessing /admin/index.php:

Warning: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

I have MySQL installed and running, but doing mysqladmin version says that its socket is /var/database/mysql/mysql.sock rather than the default /tmp/mysql.sock

Should I change the socket setting in mysql or should I change it in php/moodle? And how do I change it? (I'm not using MySQL for anything else.)

Many thanks for any advice offered,
Julian
Average of ratings: -
In reply to Julian Clementson

Re: Can't connect to MySQL server on OS X Server

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
The best thing to do is change your php.ini (you can use locate to find it, or a PHP file containing <? phpinfo() ?> )
  mysql.default_socket = /var/database/mysql/mysql.sock

You could probably also make a symbolic link:
  ln -s /var/database/mysql/mysql.sock /tmp/mysql.sock
In reply to Martin Dougiamas

Re: Can't connect to MySQL server on OS X Server

by Julian Clementson -
Martin,

There is no php.ini file in OS X, and I couldn't face searching for that string, so I tried the
ln -s
method, and all is now well!

Many thanks indeed,
Julian