If you have been surfing the web for a while, you have at least seen this error a few times. Error Establishing a Database Connection is one of those curses that could be caused by many reasons. As a WordPress beginner, this could be awfully frustrating specially when it happened on its own without you changing anything. We ran into this issue yesterday on our own site. It took a little over 20 minutes to detect and fix the problem. While doing the research to find possible causes, we realized that there was no good article that covered everything. In this article, we will show you how to fix the error establishing a database connection in WordPress by compiling a list of solutions all in one place.
Note: Before you make any database changes, make sure you have sufficient backups.
Why do you get this error?
Well in short, you are getting this error because WordPress is unable to establish a database connection. Now the reason why WordPress is unable to establish a database connection can vary. It could be that your database login credentials are wrong or have been changed. It could be that your database server is unresponsive. It could be that your database has been corrupted. In our experience, majority of the times this error happens because of some sort of server error however there could be other factors as well. Lets take a look at how to go about troubleshooting this problem.
Does the problem occur for /wp-admin/ as well?
First thing you should do is to make sure that you are getting the same error on both the front-end of the site, and the back-end of the site (wp-admin). If the error message is the same on both pages “Error establishing a database connection”, then proceed onto the next step. If you are getting a different error on the wp-admin for instance something like “One or more database tables are unavailable. The database may need to be repaired”, then you need to repair your database.
You can do this by adding the following line in your wp-config.php file:
1
define('WP_ALLOW_REPAIR', true);
Once you have done that, you can see the settings by visiting this page: http://www.yoursite.com/wp-admin/maint/repair.php
If you have been surfing the web for a while, you have at least seen this error a few times. Error Establishing a Database Connection is one of those curses that could be caused by many reasons. As a WordPress beginner, this could be awfully frustrating specially when it happened on its own without you changing anything. We ran into this issue yesterday on our own site. It took a little over 20 minutes to detect and fix the problem. While doing the research to find possible causes, we realized that there was no good article that covered everything. In this article, we will show you how to fix the error establishing a database connection in WordPress by compiling a list of solutions all in one place.Note: Before you make any database changes, make sure you have sufficient backups.Why do you get this error?Well in short, you are getting this error because WordPress is unable to establish a database connection. Now the reason why WordPress is unable to establish a database connection can vary. It could be that your database login credentials are wrong or have been changed. It could be that your database server is unresponsive. It could be that your database has been corrupted. In our experience, majority of the times this error happens because of some sort of server error however there could be other factors as well. Lets take a look at how to go about troubleshooting this problem.ไม่มีปัญหาเกิดขึ้น สำหรับ /wp-admin / เช่นสิ่งแรกที่คุณควรทำคือเพื่อ ให้แน่ใจว่า คุณได้รับข้อผิดพลาดเดียวกันบนทั้งเวอร์ของเว็บไซต์ และส่วนหลังของไซต์ (wp-admin) ถ้าข้อความแสดงข้อผิดพลาดอยู่ตรงหน้าทั้ง "การเชื่อมต่อฐานข้อมูลข้อผิดพลาด" แล้วดำเนินต่อไปยังขั้นตอนถัดไป ถ้าคุณได้รับข้อผิดพลาดต่าง ๆ บน wp-ผู้ดูแลระบบ เช่นบางสิ่งบางอย่างเช่น "ตารางฐานข้อมูลอย่าง น้อยหนึ่งไม่มี ฐานข้อมูลอาจต้องสามารถซ่อมแซม" จาก นั้นคุณจำเป็นต้องซ่อมแซมฐานข้อมูลของคุณได้คุณสามารถทำได้ โดยเพิ่มบรรทัดต่อไปนี้ในแฟ้ม wp config.php:1กำหนด ('WP_ALLOW_REPAIR' จริง);เมื่อคุณได้ทำที่ คุณสามารถดูการตั้งค่า โดยเข้าเยี่ยมชมหน้านี้: http://www.yoursite.com/wp-admin/maint/repair.php
การแปล กรุณารอสักครู่..