简体   繁体   中英

Wordpress Database Error establishing a database connection

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:

在此处输入图片说明

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)

请使用以下代码编辑wp_config文件:

define('WP_ALLOW_REPATR',true); 

在这种情况下,您将遇到用户权限问题或数据库用户名,密码或密码错误。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM