Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 27 May 2013, 23:45
leannet leannet is offline
 
Join Date: Feb 2008
Database error - can't connect to local MySQL server through socket

Does this error just happen or does it mean some one has been messing with the site?

<!--
Database error in vBulletin :

mysqli_real_connect() [&lt;a href='function.mysqli-real-connect'&gt;function.mysqli-real-connect&lt;/a&gt;]: (HY000/2002): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
/home/----------/public_html/includes/class_core.php on line 1138

MySQL Error :
Error Number :
Request Date : Monday, May 27th 2013 @ 06:37:23 PM
Error Date : Monday, May 27th 2013 @ 06:37:23 PM
Script : http://-------------.com/admincp/index.php
Referrer :
IP Address : 175.35.66.88
Username :
Classname : vB_Database_MySQLi
MySQL Version :
-->

--------------- Added 27 May 2013 at 23:54 ---------------

I found this answer

If you are getting this error, it means either:

1. The info in your config.php file is wrong (in which case your forums wouldn't work at all), or

2. MySQL crashed, it's not running or it can't find the socket. You need to contact your host about this.


What if I can't contact my host ?

Last edited by leannet; 27 May 2013 at 23:55.
Reply With Quote
  #2  
Old 28 May 2013, 00:48
skol skol is offline
 
Join Date: Oct 2008
When connecting to a MySQL server located on the local system, the mysql client connects through a local file called a socket instead of connecting to the localhost loopback address 127.0.0.1. For the mysql client, the default location of this socket file is /tmp/mysql.sock. However, for a variety of reasons, many MySQL installations place this socket file somewhere else like /var/lib/mysql/mysql.sock.

While it is possible to make this work by specifying the socket file directly in the mysql client command.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Problem with that you would be adding it constantly.

You can make a simple change to the MySQL configuration file /etc/my.cnf that will permanently set the socket file used by the mysql client. After making a backup copy of /etc/my.cnf, open it in your favorite editor. The file is divided into sections such as..


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

If there is not currently a section called [client], add one at the bottom of the file and copy the socket= line under the [mysqld] section such as:



Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

If there is already a [client] section in the my.cnf file, add or edit the socket line as appropriate. You won’t need to restart your server or any other processes. Subsequent uses of the mysql client will use the proper socket file.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 08:15.

Layout Options | Width: Wide Color: