Welcome to Geeklog Tuesday, January 17 2017 @ 12:08 pm EST

Can't connect to local MySQL server

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.

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