Can't connect to MySQL server on OS X Server

Can't connect to MySQL server on OS X Server

Napisane przez: Julian Clementson ()
Liczba odpowiedzi: 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
W odpowiedzi na Julian Clementson

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

Napisane przez: Martin Dougiamas ()
Obraz Core developers Obraz Documentation writers Obraz Moodle HQ Obraz Particularly helpful Moodlers Obraz Plugin developers Obraz 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
W odpowiedzi na Martin Dougiamas

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

Napisane przez: 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