

If everything in this file is correct (make sure you check for typos), then it is fair to say that there is something wrong on the server end. IP’s will vary for online web hosting services. For example on MAMP, the DB_Host value when changed to the IP may seem to work.

It is common to see this sort of issue when running WordPress on a local server environment. Some folks suggested that they fixed their problem by replacing localhost with the IP. Depending on the host, it will be different. Remember your DB_Host value might not always be localhost. define('DB_NAME', 'database-name') ĭefine('DB_PASSWORD', 'database-password') First thing you should always check is if everything in your wp-config.php file is the same. If you changed your root password, or the database user password, then you will need to change this file as well. This is where you specify the details for WordPress to connect your database.

WP-Config.php is probably the single most important file in your entire WordPress installation. If this repair did not fix the problem, or you are having trouble running the repair then continue reading this article as you might find another solution to work. So once you are done repairing and optimizing your database, make sure to remove this from your wp-config.php. This is because its main intent is to repair a corrupted database, Users can often not login when the database is corrupt. Remember, the user does not need to be logged in to access this functionality when this define is set. Once you have done that, you can see the settings by visiting this page: Add it just before ‘That’s all, stop editing! Happy blogging’ line wp-config.php. You can do this by adding the following line in your wp-config.php file. The database may need to be repaired”, then you need to repair your database. If you are getting a different error on the wp-admin for instance something like “One or more database tables are unavailable. If the error message is the same on both pages “Error establishing a database connection”, then proceed onto the next step. Does the problem occur for /wp-admin/ as well?įirst 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).
#Mamp wordpress database connection error how to#
Lets take a look at how to go about troubleshooting this problem. Majority of the times this error happens because of some sort of server error however there could be other factors as well. Your database login credentials are wrong or have been changed.

We’re createad a list with the several of famous issues: Now the reason why WordPress is unable to establish a database connection can vary. You are getting this error because WordPress is unable to establish a database connection. Note: Before you make any database changes, make sure you have sufficient backups. 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. Error Establishing a Database Connection is one of those curses that could be caused by many reasons.
