Welcome to Geeklog, Anonymous Saturday, November 23 2024 @ 06:21 am EST

Question: Can't connect to local MySQL server

Answer: When you encounter an error such as

Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /path/to/geeklog/system/databases/mysql.class.php on line 112
Cannnot connect to DB server
then this means just what the error message says: Geeklog could not establish a connection to the MySQL server.

Typically, that means that either the MySQL server is not running at all or that your setting for $_DB_host (in your db-config.php) is not correct.

So double-check that $_DB_host contains the name of your MySQL server. And if that doesn't help, ensure that the MySQL server is really running (which, unless it's your own server, means that you should be talking to your hosting service).

If you find that the MySQL server is running and the $_DB_host setting is correct, check that the socket is correct, i.e. that MySQL is using the socket that PHP expects. Compare the "socket" entry in MySQL's my.cnf config file with the output you get from phpinfo() (you can use the /admin/install/info.php file that ships with Geeklog to get the phpinfo() output). This usually only happens when you installed either PHP or MySQL yourself.

Hits: 254

FAQ » Common problems » Can't connect to local MySQL server