vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Database error - can't connect to local MySQL server through socket (https://vborg.vbsupport.ru/showthread.php?t=298521)

leannet 05-27-2013 10:45 PM

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 [DATE]1369698881[/DATE] at [TIME]1369698881[/TIME] ---------------

I found this answer

Quote:

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 ?

skol 05-27-2013 11:48 PM

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.

Code:

mysql --socket=/var/lib/mysql/mysql.sock ...
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..

Code:

[mysqld]
datadir=/usr/local/mysql/data
socket=/var/lib/mysql/mysql.sock

Code:

[mysql.server]
user=mysql
basedir=/usr/local/mysql

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:


Code:

[client]
socket=/var/lib/mysql/mysql.sock

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.


All times are GMT. The time now is 02:50 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01007 seconds
  • Memory Usage 1,718KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete