[need help] Error establishing a database connection

Sashidhar073

Well-known member
Babiato Lover
Trusted Seller
Banned User
Jul 7, 2020
431
350
63
India
Im getting "
Warning: mysqli_real_connect(): (HY000/2002): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/trc4gtr0azhv/public_html/wp-includes/wp-db.php on line 1653

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Error establishing a database connection
"

this error..

phpmy admin is not opening and MySQL data base is also throwing error "
Error while connecting to MySQL: (XID aa4ucu) The system failed to connect to the “MySQL” database “mysql” because of an error: CR_CONNECTION_ERROR (Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)) Error while connecting to MySQL: (XID aa4ucu) The system failed to connect to the “MySQL” database “mysql” because of an error: CR_CONNECTION_ERROR (Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)) at /usr/local/cpanel/Cpanel/Mysql/Basic.pm line 391, <STDIN> line 1." my SQL is offline

MySQL is offline


any help pls,
 

yassine2217

Member
Feb 17, 2021
87
33
18
Casablanca
For your first error this what i found on google
Are you connecting to "localhost" or "127.0.0.1" ? I noticed that when you connect to "localhost" the socket connector is used, but when you connect to "127.0.0.1" the TCP/IP connector is used. You could try using "127.0.0.1" if the socket connector is not enabled/working.
 

shady

New member
May 11, 2020
10
0
1
What kind of hosting you are on? if this is a shared webhosting contact your provider and tell him that mysql is down
if you are using a VPN you'll have to restart mysql
 

Sashidhar073

Well-known member
Babiato Lover
Trusted Seller
Banned User
Jul 7, 2020
431
350
63
India
What kind of hosting you are on? if this is a shared webhosting contact your provider and tell him that mysql is down
if you are using a VPN you'll have to restart mysql
this is godaddy hosting, they are not even responding.
 

rajujha

Member
Jul 24, 2019
54
6
8
For your first error this what i found on google
Are you connecting to "localhost" or "127.0.0.1" ? I noticed that when you connect to "localhost" the socket connector is used, but when you connect to "127.0.0.1" the TCP/IP connector is used. You could try using "127.0.0.1" if the socket connector is not enabled/working.
how to do it?
Assuming that you have a linux shared hosting (most have that only). Here's the link for instructions to enable ssh.


After you have your credentials download ssh software called putty and login with these credentials and run the command

sudo systemctl start mysql

Alternatively, you can contact and request your hosting provider to restart mysql. Or, you may look for option to restart mysql in cpanel. I have not used shared GoDaddy shared hosting for a long time, so not sure if they have that option.
 
  • Like
Reactions: Simbaa

Sashidhar073

Well-known member
Babiato Lover
Trusted Seller
Banned User
Jul 7, 2020
431
350
63
India
Assuming that you have a linux shared hosting (most have that only). Here's the link for instructions to enable ssh.


After you have your credentials download ssh software called putty and login with these credentials and run the command

sudo systemctl start mysql

Alternatively, you can contact and request your hosting provider to restart mysql. Or, you may look for option to restart mysql in cpanel. I have not used shared GoDaddy shared hosting for a long time, so not sure if they have that option.


Thanks man, it worked :)
 
  • Like
Reactions: Simbaa

About us

  • Our community has been around for many years and pride ourselves on offering unbiased, critical discussion among people of all different backgrounds. We are working every day to make sure our community is one of the best.

Quick Navigation

User Menu