Can't connect to MySQL server on OS X Server

Can't connect to MySQL server on OS X Server

von Julian Clementson -
Anzahl Antworten: 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
Als Antwort auf Julian Clementson

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

von Martin Dougiamas -
Nutzerbild von Core developers Nutzerbild von Documentation writers Nutzerbild von Moodle HQ Nutzerbild von Particularly helpful Moodlers Nutzerbild von Plugin developers Nutzerbild von 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
Als Antwort auf Martin Dougiamas

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

von 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