Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’

Warning: mysqli::mysqli() [mysqli.mysqli]: (HY000/2002): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /var/www/egmonitor/index.php on line 11

The socket file is not found on the default /tmp folder in ubuntu. Rather, it was placed inside /var/run/mysqld/mysqld.sock

You can get this from /etc/mysql/my.cnf file

http://www.tech-recipes.com/rx/762/solve-cant-connect-to-local-mysql-server-through-socket-tmpmysqlsock/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s