0
votes

I updated my PHP from 5.4 to 7 and after that my wordpress website cannot connect to the database.

When I put the line define('WP_ALLOW_REPAIR', true); within the wp-config.php and go to address: http://www.address.com/wp-admin/maint/repair.php I still have the same error

Error establishing a database connection

When I connect to my wp-admin, I got the following:

enter image description here

Finally I checked my credential on my database within wp-config.php, they are correct but when I do a mysql> show databases; I got the following:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
2
@JehadNasser Thanks it works - ChinaXiaoHong

2 Answers

0
votes

please edit wp_config file use this code:

define('WP_ALLOW_REPATR',true); 
-1
votes

In this case you have problem with user privilege or wrong database user, name ore password.