Can't connect to MySQL server on OS X Server

Can't connect to MySQL server on OS X Server

- Julian Clementson の投稿
返信数: 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
Julian Clementson への返信

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

- Martin Dougiamas の投稿
画像 Core developers 画像 Documentation writers 画像 Moodle HQ 画像 Particularly helpful Moodlers 画像 Plugin developers 画像 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
Martin Dougiamas への返信

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

- 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