WPBeginner

Beginner's Guide for WordPress

  • Blog
    • Beginners Guide
    • News
    • Opinion
    • Showcase
    • Themes
    • Tutorials
    • WordPress Plugins
  • Start Here
    • How to Start a Blog
    • Create a Website
    • Start an Online Store
    • Best Website Builder
    • Email Marketing
    • WordPress Hosting
    • Business Name Ideas
  • Deals
    • Bluehost Coupon
    • SiteGround Coupon
    • WP Engine Coupon
    • HostGator Coupon
    • Domain.com Coupon
    • Constant Contact
    • View All Deals »
  • Glossary
  • Videos
  • Products
X
☰
Beginner's Guide for WordPress / Start your WordPress Blog in minutes
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

WPBeginner» Blog» Tutorials» How to Fix the Error Establishing a Database Connection in WordPress

How to Fix the Error Establishing a Database Connection in WordPress

Last updated on January 14th, 2020 by Editorial Staff
859 Shares
Share
Tweet
Share
Pin
Free WordPress Video Tutorials on YouTube by WPBeginner
How to Fix the Error Establishing a Database Connection in WordPress

Are you seeing the ‘Error establishing a database connection’ notice on your WordPress website? It is a fatal error that makes your WordPress website inaccessible to the users.

This error occurs when WordPress is unable to make a connection to the database. A number of things can affect your WordPress database connection which makes it a bit difficult for beginners to troubleshoot.

In this article, we will show you how to easily fix the error establishing a database connection in WordPress.

Fixing the database connection error in WordPress

What Causes Error Establishing a Database Connection in WordPress?

The ‘Error establishing a database connection’ issue can be caused by incorrect database information in your WordPress settings, corrupt database, or an irresponsive database server.

Database connection error in WordPress

A database is a software which makes it easy to store, organize, and retrieve data into other software.

As a content management system, WordPress uses a database to store all your content and other website data. It then connects to the database each time someone visits your website.

WordPress needs the following information for connecting to the database:

  • Database name
  • Database username
  • Database password
  • Database server

This information is stored in your WordPress configuration file called wp-config.php.

If any of these items are incorrect, WordPress would fail to connect to your database server, and you’ll see the ‘Error establishing a database connection’ error.

It is one of the most common WordPress errors. Apart from incorrect credentials, this error can also appear if the database server is down, or the database files are corrupt.

Let’s take a look at how to fix error establishing database connection issue in WordPress with step by step troubleshooting.

1. Check Your WordPress Database Credentials

The most common reason for database connection error in WordPress is incorrect database credentials. If you have recently moved your WordPress site to a new host, then this could be the most likely reason.

Your WordPress database credentials are stored in the wp-config.php file. It is the WordPress configuration file that contains important WordPress settings including database information.

If you have not edited wp-config.php file before, then take a look at our guide on how to edit wp-config.php file in WordPress.

You’ll be looking for the following lines in the wp-config.php file.


// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );
/** MySQL database username */
define( 'DB_USER', 'username_here' );
/** MySQL database password */
define( 'DB_PASSWORD', 'password_here' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

You need to make sure that the information for the database name, username, password, and database host is correct.

You can confirm this information from your WordPress hosting account dashboard. Simply log in to your hosting account and click on MySQL databases under the database section.

Database information

This will take you to the database management page in your hosting dashboad. From here, you can find out your database name and the username.

Database name and username

Below that you will find the database users and links to change the user password.

Changing database user password

Once you have confirmed your database name, username, and password, you can change that information in your wp-config.php file if needed.

After that, try visiting your website again to see if the database connection error has gone.

If you can still see the error, then this means that something else is wrong. Continue reading for more troubleshooting steps.

2. Check Your Database Host Information

If you are confident that your database name, username, and password information is correct, then you may want to make sure that you are using the correct database host information.

Most WordPress hosting companies use localhost as your database host. However, some managed WordPress hosting companies use separate servers to host databases. In that case, your database host information will not be localhost.

You need to contact your WordPress hosting company to confirm your database host information.

3. Repair WordPress Database

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. Make sure to add it just before ‘That’s all, stop editing! Happy blogging’ line wp-config.php.

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

Repair WordPress database

Note: the user does not need to be logged in to access the database repair page. Once you are done repairing and optimizing your database, make sure to remove this code from your wp-config.php.

4. Check if Your Database Server is Down

If everything seems to be correct, and WordPress still cannot connect to the database, then your database server (MySQL server) may be down.

This could happen due to heavy traffic on a server. Basically, your host server just cannot handle the load (especially when you are on shared hosting).

Your site will get really slow and for some users it may even output the error. So the best thing you should do is get on the phone or live chat with your hosting provider and ask them if your MySQL server is responsive.

If you have other websites running on the same server, then you can check those sites to confirm that your SQL server is down.

If you do not have any other site on the same hosting account, then simply go to your hosting dashboard and try to access phpMyAdmin and connect the database.

If you can connect, then we need to verify if your database user has sufficient permission. Create a new file called testconnection.php and paste the following code in it:

<?php
$link = mysqli_connect('localhost', 'username', 'password');
if (!$link) {
die('Could not connect: ' . mysqli_error());
}
echo 'Connected successfully';
mysqli_close($link);
?>

Make sure to replace the username and password. You can now upload this file to your website and access it via web browser.

If the script connected successfully, then it means that your user has sufficient permission, and there is something else that is wrong.

Go back to your wp-config file to make sure that everything there is correct (re-scan for typos).

Other Solutions That Have Worked for Users

If the above-mentioned troubleshooting tips failed to fix the database connection error on your website, then you may try these additional steps.

Reported by our users, these steps have helped some users resolve the database connection error on their websites.

1. Update WordPress Site URL

Try updating the WordPress site URL using phpMyAdmin. Simply access phpMyAdmin from your hosting account dashboard, and select your WordPress database.

Running SQL in phpMyAdmin

After that click on the SQL menu on the top and enter the following MySQL query.

UPDATE wp_options SET option_value='YOUR_SITE_URL' WHERE option_name='siteurl'

Don’t forget to provide your own site URL and change wp_options to your own table name as you may have changed the WordPress table prefix.

2. Rebooting Web Server

Users on dedicated servers, local server, and virtual private servers (VPS) can try rebooting their servers.

This will restart your web and database server which may fix some temporary glitches causing the error.

3. Ask for help

If everything else fails, then you may need to contact your web hosting company. All good WordPress hosting companies will help you troubleshoot the problem, point you in the right direction, or even fix it for you.

You can also hire WordPress developers from Codeable that can help you fix this issue for reasonable rates. The best part is that these developers are highly-vetted by Codeable team, so you know they can be trusted.

We hope this article helped you fix the error establishing a database connection in WordPress. You may also want to see our WordPress troubleshooting guide for tips on resolving WordPress issues on your own.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

859 Shares
Share
Tweet
Share
Pin
Popular on WPBeginner Right Now!
  • Revealed: Why Building an Email List is so Important Today (6 Reasons)

    Revealed: Why Building an Email List is so Important Today (6 Reasons)

  • Checklist

    Checklist: 15 Things You MUST DO Before Changing WordPress Themes

  • How to Fix the Error Establishing a Database Connection in WordPress

    How to Fix the Error Establishing a Database Connection in WordPress

  • How to Properly Move Your Blog from WordPress.com to WordPress.org

About the Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Trusted by over 1.3 million readers worldwide.

The Ultimate WordPress Toolkit

642 Comments

Leave a Reply
  1. Arafat says:
    Apr 27, 2013 at 1:18 pm

    Sometimes when I click on the “Publish” button to post a new article on my WordPress blog, then this error message appears:

    “”Error establishing a database connection… This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at localhost. This could mean your host’s database server is down…..””

    Despite the error message appears, my post got published and there is no problem with visiting my site. This error does not come after each post publication. Sometimes it occurs. (My hosting reseller provider changed my server some days ago and this problem began after coming to the new server) What is the problem and how to solve it, please tell …… Thanks.

    Reply
    • Editorial Staff says:
      Apr 29, 2013 at 9:31 am

      It sounds like that you are having a memory issue on the new server.

      Reply
  2. Quinton says:
    Apr 24, 2013 at 1:51 am

    The wp-config.php fix worked for me!! Thanks so much!

    Reply
  3. Josh says:
    Apr 23, 2013 at 2:39 am

    I found a github repo which restarts the mysql server of wordpress if there is a database error using node.js http://goo.gl/gnXLR

    Reply
  4. Brian Deyo says:
    Apr 22, 2013 at 3:58 pm

    The quick snippet of PHP you provided was everything I needed to track down my issue.Thanks for the post!

    Reply
  5. Mario Ben says:
    Apr 14, 2013 at 10:42 pm

    I am very excited to find this solution. I got the exact problem with my website and after searching it, I found this amazing article.
    Thank you so much!

    Reply
  6. HighHopes says:
    Apr 14, 2013 at 9:36 pm

    i was using Xampp on local machine to host my wordpress site and got error “Error Establishing the Database Connection”. first time i got that .. not sure why. i noticed in Xampp setup that the user and their privileges was deleted somehow. so i made a new user, using same user name as in ws-config, using host “localhost” and password same as in ws-config. worked like a charm :)

    Reply
  7. Olly says:
    Apr 12, 2013 at 3:32 pm

    You’re a lifesaver. Many thanks!

    Reply
  8. Karl says:
    Apr 6, 2013 at 9:42 am

    I got error but after couple minutes everything got back normal, any way to avoid getting this error in future?

    Reply
  9. ben says:
    Apr 4, 2013 at 11:02 am

    really great post !
    helped me revive my wp-blog :)
    thanks !

    Reply
  10. Demannu says:
    Mar 28, 2013 at 11:37 pm

    THANK YOU AUTHOR!!! Your little TestConnection script has saved me some serious non-paid time.

    MUAH! / HUG / HIGH FIVE

    Reply
    • El Hombre says:
      Apr 15, 2013 at 8:27 am

      Really, this post has been a last-minute rescue. Many thanks to the editor.
      Cheers el hombre

      Reply
  11. RaDLab says:
    Mar 28, 2013 at 5:11 pm

    Great article by the way.
    My issue is somehow strange to me. In the last couple of days maybe weeks, every morning few of my sites on my server will get the Error establishing connection prompt. But after a few minutes, it starts to work without me doing anything. For example, I will get an email from a client that the Error is showing, but when I quickly check it on my end, it works fine, and The client will also notice it back up. So my problem is strange, I’m not sure what to check if everything seem to resolve itself. Is possible because of high traffic?

    Reply
    • Editorial Staff says:
      Apr 1, 2013 at 8:45 am

      Your issue is happening due to server overload. While this can mean high traffic, but it doesn’t always mean that. Sometimes, you have medium traffic but a bad plugin that is doing it. Other times, it is just high traffic.

      Reply
      • RaDLab says:
        Apr 1, 2013 at 11:43 am

        Thanks for the response.
        This has never happened before. Just today, I’ve had to restart MySQL several times to keep many of my sites running, while I try to figure why it keeps losing connection. I’m really baffled by this. I’ve looked into the php.ini looking for where to increase any sort of limits, but I come up with nothing. It’s running right now, but soon it will fail to connect until I restart MySQL.

        Any ideas on how to adjust to the high traffic and keep the MySQL server running?

        Reply
        • Editorial Staff says:
          Apr 2, 2013 at 7:57 am

          One thing you can do is increase your PHP memory limit. If you are running at 32MB, then that could be a reason. But you will get to a point when your current servers just can’t handle it. You would have to upgrade. Not sure what your server specs are, and how much load you are putting on it.

          Run your server logs and see which processes are causing the load. Then see if those can be eliminated or optimized.

    • XeNNo says:
      Apr 2, 2013 at 8:09 am

      I have seen that too myself.
      This is happening to me, not only with wordpress but also with joomla and piwik and everything that i use to work with and needs a database.
      My provider seems to have a different machine for the MySQL service and every now and then the connection between my sites and the MySQL server drops and give me failure.

      You should check that this is your case too… and if so… get another host service :D

      Reply
      • RaDLab says:
        Apr 2, 2013 at 11:52 am

        Thanks for your input. I think I have narrowed it down to a db instance that was causing my MySQL to lose connection. It’s an instance running a ELGG system. Soon as I discovered how much load this instance was putting on the server, I deleted it. Since then, the Error has seem to have stopped. Who knew…

        Reply
  12. aly says:
    Mar 26, 2013 at 9:32 pm

    for me it was the sql password, which had a symbol ( ] ) at the end.
    After giving up on all other “fixes,” I edited the password and presto! All good ;)

    Reply
  13. yogesh says:
    Mar 21, 2013 at 11:29 pm

    a very big thanks from me to you because first i website show 500 internel error i fix it by read wpbeginner article now my site show error establishing a database connection i fix it by read your article….thankssssss

    Reply
  14. mhisyam6 says:
    Mar 16, 2013 at 1:10 am

    My problem solved from this error just by reinstall/update the wordpress in the dashboard.

    Reply
    • Raul says:
      Mar 22, 2013 at 3:41 am

      Which version of wordpress did you upgrade to? I was previously on 3.5.1 but read that the 3.5 version is bugged, so I downgraded to 3.4.2. It’s more stable now but I still see the error…

      Reply
  15. Matt says:
    Mar 11, 2013 at 2:39 pm

    This has been a question asked by many of our past clients and is such a pain to explain this. Pretty much, 100% of the time I end up having to go in and fix it myself.

    Reply
  16. Fanto Chandra says:
    Mar 7, 2013 at 3:48 am

    I just do repairing the database via cpanel-mysql database and choosing repair database and turn out working and can open the site again now. Thanks for the clue from your explanation.

    Reply
  17. Christine says:
    Mar 6, 2013 at 11:01 pm

    my own hosting company couldn’t help me. thank you. the first option worked great.

    Reply
  18. Alex Patterson says:
    Mar 5, 2013 at 3:47 pm

    Just went through this issue – and the problem turned out to be that my mysql database was by default using the old 16 byte hashes for the passwords, rather than the 41 byte hashes that the more recent versions of php scripts that WordPress uses requires.

    To see if this is the issue, you can look at your user table in mysql:

    select user, host, password from mysql.user;

    If the password column for your user is 16 characters rather than 41, that is your issue.

    You will need to temporarily set the hashing to 41 digits and then re-encode your password:

    set @@session.old_passwords = 0;
    set password for ‘wordpress_user’@’localhost’=PASSWORD(‘password’);

    Reply
  19. Joshua says:
    Feb 25, 2013 at 9:53 am

    Just wanted to say “thank you” – this just saved me a ton of time and trouble.

    Reply
  20. Emdad Shaon says:
    Feb 24, 2013 at 12:01 pm

    Thanx man……changing mysql password fix my problem…. RESPECT

    Reply
    • Joe says:
      Feb 26, 2013 at 11:10 am

      Where can I find the password for a mysql database?

      Reply
      • Editorial Staff says:
        Feb 27, 2013 at 6:12 am

        This is in your cPanel.

        Reply
  21. Jamie says:
    Feb 10, 2013 at 7:29 pm

    What should I do if it won’t let me log into my cpanel either? :(

    Reply
    • Editorial Staff says:
      Feb 21, 2013 at 10:59 am

      Contact your web hosting provider.

      Reply
  22. TP says:
    Feb 8, 2013 at 3:54 pm

    Great tip I was able to login through backend and reload my site with no more error messages. Took five minutes! Thanks.

    Reply
  23. Geeky says:
    Feb 6, 2013 at 3:34 pm

    Thank you, changing password and username worked!

    Reply
  24. YF says:
    Jan 28, 2013 at 11:16 am

    THANKS A LOT!!!!

    This really helped me.

    Reply
  25. Markus says:
    Jan 21, 2013 at 8:42 am

    After editing the wp-config.php and updating with new credentials, the error was still present. I had also to clear my APC opcode cache!

    Reply
  26. Evik says:
    Jan 5, 2013 at 6:16 pm

    Hi,

    thank you for this article. I got this error twice and each time I tried to login into my cpanel it helped. Nothing else, but log into the cpanel resolved my problem.

    It does not make sense, and I have no idea what is going on.

    I got the message every time after I have made some changes on the website (the last time I was putting on a new email subscription).

    Reply
  27. Ben Nafi says:
    Jan 2, 2013 at 4:23 am

    Thanks sharing..
    Thats helped me.. :)

    Reply
  28. Rae says:
    Dec 18, 2012 at 5:01 pm

    Aside from updating wp-config.php, I had to update the domain for the following tables:
    wp_blogs
    wp_site
    wp_options -> option_value (for option_name siteurl, home)
    If you use WPMU, you will need to update ALL wp_options tables.

    The error would NOT go away until all of this was done.

    Reply
  29. sara says:
    Dec 16, 2012 at 11:50 am

    This happened to our site the other day, we got the dreaded error! We received a large amount of traffic but it was expected. We were using Quick Cache as the plugin and the hosts changed it for Super cache and also told us we had hit MySQL max_user_connections due to the queries on the wp_options table. They told us after installing super cache it’s taken us from 600+ database connections to under 5.

    After installing the super cache plugin everything worked great again. Now I am concerned about this happening in future, what can I do to try and prevent this? We will always have a large surge in tarffic and then very quiet moments. How can I be sure the database will be able to cope with such demands?

    Thanks

    Reply
  30. smithers says:
    Dec 12, 2012 at 3:03 pm

    i had “error connecting to database” problem twice in the past two days on a wordpress site on an amazon ec2 micro instance. it occurred after sending out a blast email regarding a fund raising campaign and asking people to check out the site, so i assume it was a load-related failure. anyway, the first time it occurred, i tried to restart the database (service mysqld restart), and it shutdown OK but wouldn’t restart. i then restarted apache (service httpd restart) and then restarted the database, and the database and site came back up.

    the problem occurred again today, and the database restart worked without having to restart apache.

    Reply
    • Editorial Staff says:
      Dec 12, 2012 at 3:19 pm

      Are you using a proper caching solution? This shouldn’t happen unless you are receiving a crazy load of traffic.

      Reply
    • Jon says:
      Dec 14, 2012 at 12:07 pm

      The scenario you describe is almost certainly caused by your EC2 instance being out of available memory. When you restart Apache a huge chunk of memory is released; only the minimum resources required to get the server up and running are re-allocated when Apache comes back up, then mysqld has plenty of elbow room to start.

      A few good places to start fixing this:

      1. Check your php.ini memory limit
      2. Check your innodb_buffer_pool_size setting in my.cnf
      3. Check your swap space

      Reply
    • Jamie says:
      Jan 18, 2013 at 6:59 am

      I’m running an Amazon EC2 instance also & restarting apache & then restarting mysqld worked for me too.

      Reply
  31. Daniel says:
    Nov 30, 2012 at 9:26 am

    I was moving some webspace from an older to a newer server and tested some things, got stuck with this error. This helped, thanks a lot:
    update wp_options set option_value=’http://www.newsitename.de’ where option_name=’siteurl’;

    Reply
  32. Shawn says:
    Nov 25, 2012 at 11:28 am

    Thanks a lot! I was waiting for support from my host for hours…Sundays…but they took too long. My problem was my database password in wp-config, which was different from the real password. I changed it and everything is fine again.

    *bookmarked

    Reply
  33. hanneng says:
    Nov 19, 2012 at 4:00 am

    recently I also face the same problem on my blog at http://www.hanneng.net after moved to a VPS.

    the solution is to modify the wp-config.php

    define(‘DB_HOST’, ‘localhost:/tmp/mysql.sock’);

    Reply
  34. tristan says:
    Nov 9, 2012 at 6:19 pm

    Thank you so much! I had messed around in my functions php and lost the ability to open my website. in the process of trying to fix this issue I changed my password for database access and had no idea it was the cause for my error establishing database connection. I’m sure this seems fairly simple to someone who is familiar with this web stuff but for someone like me who is just a dabbler it was very frustrating. website works great now! thank you.

    Reply
  35. XeNNo says:
    Nov 7, 2012 at 6:50 am

    Actually I’ve had a different problem and took me some time to resolve it. My wp after moving from one server to another, editing all files needed (wp-config) started loading on home page nicely. Also the wp-admin section worked like a charm … but still the problem apeared when I started to point on pages and articles … all of theme besides homepage get me the mysql error regarding connection to database….
    So…. looking on the internet I’ve found this article of yours and tried your advices … my problem not getting resolved on any of them.
    Somehow … don’t know why… my .htaccess file pointed on another default root document and after editing my .htaccess …. :D everything started to work …
    Thought somebody will need that …

    Reply
  36. Anne says:
    Oct 17, 2012 at 3:27 pm

    MANY many thanks for posting this. Thought I was going to have to start all over. Being one step above novice is not always sufficient! GAH!

    Reply
  37. Sean Murphy says:
    Sep 28, 2012 at 4:21 pm

    Thanks for this post. The adding that line of php code in the first para did the trick for my sites.

    Reply
  38. Lucy Gage says:
    Sep 24, 2012 at 8:13 pm

    Hi there,

    I am getting this error every day “Error establishing a network connection”. The site was working perfectly, then after the first day I got up in the morning and check the site and saw the error for the first time. I logged into the crazy domains control panel and the database was missing. I called support and it took them all day to fix the problem, but then the site was ok again.

    The next morning the same problem again. I called support again. After a couple of hours the site was back working again.

    The next morning – the same problem again. another hour speaking to support, but they don’t actually tell me what the problem is.

    I am so worried about this and jsut want the problem fixed. Do you think it could be anything I have done whilst setting up the website, or just a problem with the host?

    Reply
    • Editorial Staff says:
      Sep 24, 2012 at 10:45 pm

      It could be a number of things. One of the plugins you are using is exhausting the database server. Another reason could be that your host is overselling the shared hosting plan you maybe on. This would result in database connection error.

      https://www.wpbeginner.com/wordpress-hosting/ << See this page if you are looking to find a better web host.

      Reply
  39. Hayley says:
    Sep 20, 2012 at 9:49 am

    I actually read half of the 2nd paragraph and managed to fix my site… excellent – thanks.

    Reply
    • Editorial Staff says:
      Sep 20, 2012 at 10:32 am

      Glad you got it fixed :)

      Reply
  40. Jenn Hunter says:
    Sep 10, 2012 at 9:00 pm

    Thank you for writing this article. It helped me when having to reload my WP website from a previous back up.

    Reply
  41. Damian says:
    Sep 8, 2012 at 3:02 am

    What happened with me is the php.config’s password didn’t match..downloading config.php and putting in the proper password fixed it!

    Reply
  42. Guest says:
    Sep 7, 2012 at 3:07 am

    Hi, I run WordPress multisite and just went through an update. I have a blog that has a static front page and a separate page for blog entries. When I tried to open the blog page, I got the above message, Error Establishing a Database Connection.

    Turned out I needed to click the yellow bar that appears when you do a major WordPress update, to Update Network which synchs everything database-wise on all sites in your Multisite install. Blog page is viewable now and everything’s working fine!

    Reply
  43. Rob Rawson says:
    Sep 2, 2012 at 11:15 pm

    My solution was to install DBVisualizer and what it showed me was that while the dbname was right it was in the wrong case. So changing the db name from wp to WP in my wp-config.php resolved this issue. No idea how this worked in the first place since this was up and running.

    Reply
  44. Anna Crowe says:
    Aug 29, 2012 at 4:28 pm

    This was a well written and thorough article. Thank you. Not everything applied to me, but I was able to troubleshoot and identify the problem using some of these suggestions. I’m praising your name today! Thanks.

    Reply
  45. Jacob Degeling says:
    Aug 22, 2012 at 5:39 pm

    Hi,

    I moved my wp-config.php from the dir below the www root into the www root. That brought the site back up. I would prefer the wp-config.php to be outside the www root, so I’ll have to look into why it wasn’t working in the first place.

    Thanks for the help.

    Jacob

    Reply
  46. chris says:
    Aug 13, 2012 at 8:17 am

    sql.safe_mode=On in php.ini hosed my multisite install this way. Change it back and the site came up again.

    Reply
  47. blkbam says:
    Jul 19, 2012 at 5:53 pm

    One thing to check on if you are moving from your system to the server and using MySQL is the case of the database name. In my situation the server is in all lowercase while my development is all uppercase. Iit’s a very easy over site.

    Reply
    • Editorial Staff says:
      Jul 20, 2012 at 7:30 am

      Good suggestion :)

      Reply
  48. Laura says:
    Jul 18, 2012 at 8:28 am

    I had this error on my site – i called my host who told me that my username was being denied permission to the database.

    No idea how this happened as I hadn’t gone near these details. However, they assured me this was a common problem.

    Within 1 minute of the phone call ending, my site was back up and running.

    Very strange….but glad its working again!

    Great article btw! Glad i didnt need to use it in the end but very easy to understand if i had!

    Reply
    • Editorial Staff says:
      Jul 18, 2012 at 10:12 am

      Yeah sometimes the cats that work in the servers start having hiccups :) Glad that your site is working now.

      Reply
  49. RB says:
    Jun 16, 2012 at 9:12 am

    My wordpress site was working fine. Then I got the “Error Establishing the Database Connection” message. Doing a Google search, there was a lot of information on what to do. This was the most helpful to me. It ended up that my database options table had crashed. I repaired it per this post and my wordpress site it works fine again. Thanks!

    Reply
  50. Asif says:
    Apr 30, 2012 at 2:23 am

    try checking for the php version as well, sometimes it is the php version on the server that could cause the issue.

    Reply
1 2 3 … 10 »

Leave a Reply Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

Over 1,320,000+ Readers

Get fresh content from WPBeginner

Featured WordPress Plugin
MonsterInsights
MonsterInsights
Google Analytics made easy for WordPress. Learn More »
How to Start a Blog How to Start a Blog
I need help with ...
Starting a
Blog
WordPress
Performance
WordPress
Security
WordPress
SEO
WordPress
Errors
Building an
Online Store
Useful WordPress Guides
    • 7 Best WordPress Backup Plugins Compared (Pros and Cons)
    • How to Fix the Error Establishing a Database Connection in WordPress
    • Why You Need a CDN for your WordPress Blog? [Infographic]
    • 30 Legit Ways to Make Money Online Blogging with WordPress
    • Self Hosted WordPress.org vs. Free WordPress.com [Infograph]
    • Free Recording: WordPress Workshop for Beginners
    • 24 Must Have WordPress Plugins for Business Websites
    • How to Properly Move Your Blog from WordPress.com to WordPress.org
    • 5 Best Contact Form Plugins for WordPress Compared
    • Which is the Best WordPress Popup Plugin? (Comparison)
    • Best WooCommerce Hosting in 2020 (Comparison)
    • How to Fix the Internal Server Error in WordPress
    • How to Install WordPress - Complete WordPress Installation Tutorial
    • Why You Should Start Building an Email List Right Away
    • How to Properly Move WordPress to a New Domain Without Losing SEO
    • How to Choose the Best WordPress Hosting for Your Website
    • How to Choose the Best Blogging Platform (Comparison)
    • WordPress Tutorials - 200+ Step by Step WordPress Tutorials
    • 5 Best WordPress Ecommerce Plugins Compared
    • 5 Best WordPress Membership Plugins (Compared)
    • 7 Best Email Marketing Services for Small Business (2020)
    • How to Choose the Best Domain Registrar (Compared)
    • The Truth About Shared WordPress Web Hosting
    • When Do You Really Need Managed WordPress Hosting?
    • 5 Best Drag and Drop WordPress Page Builders Compared
    • How to Switch from Blogger to WordPress without Losing Google Rankings
    • How to Properly Switch From Wix to WordPress (Step by Step)
    • How to Properly Move from Weebly to WordPress (Step by Step)
    • Do You Really Need a VPS? Best WordPress VPS Hosting Compared
    • How to Properly Move from Squarespace to WordPress
    • How to Register a Domain Name (+ tip to get it for FREE)
    • HostGator Review - An Honest Look at Speed & Uptime (2020)
    • SiteGround Reviews from 4196 Users & Our Experts (2020)
    • Bluehost Review from Real Users + Performance Stats (2020)
    • How Much Does It Really Cost to Build a WordPress Website?
    • How to Create an Email Newsletter the RIGHT WAY (Step by Step)
    • Free Business Name Generator (A.I Powered)
    • How to Create a Free Business Email Address in 5 Minutes (Step by Step)
    • How to Install Google Analytics in WordPress for Beginners
    • How to Move WordPress to a New Host or Server With No Downtime
    • Why is WordPress Free? What are the Costs? What is the Catch?
    • How to Make a Website in 2020 – Step by Step Guide
Deals & Coupons (view all)
LiveChat logo
LiveChat Inc Coupon
Get a 30 day free trial and 30% OFF LiveChat, one of the best live chat service providers for WordPress users.
ConvertKit Coupon Code
ConvertKit Coupon
Get a 14-day no risk FREE trial with this powerful email marketing software.
Featured In
About WPBeginner®

WPBeginner is a free WordPress resource site for Beginners. WPBeginner was founded in July 2009 by Syed Balkhi. The main goal of this site is to provide quality tips, tricks, hacks, and other WordPress resources that allows WordPress beginners to improve their site(s).
Join our team: We are Hiring!

Site Links
  • About Us
  • Contact Us
  • FTC Disclosure
  • Privacy Policy
  • Terms of Service
  • Free Blog Setup
  • Free Business Tools
Our Sites
  • OptinMonster
  • MonsterInsights
  • WPForms
  • SeedProd
  • Nameboy
  • RafflePress
  • Smash Balloon

Copyright © 2009 - 2021 WPBeginner LLC. All Rights Reserved. WPBeginner® is a registered trademark.

Managed by Awesome Motive | WordPress hosting by SiteGround | WordPress CDN by MaxCDN | WordPress Security by Sucuri.