Topics

User Functions

Events

There are no upcoming events

What's New

Stories last 2 weeks

No new stories

Comments last 2 weeks

No new comments

Trackbacks last 2 weeks

No new trackback comments

Links last 2 weeks

No recent new links

NEW FILES last 14 days

No new files

Welcome to Geeklog Saturday, April 19 2014 @ 07:59 AM EDT

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