Title: Receiving Error establishing a database connection
Last modified: August 31, 2016

---

# Receiving Error establishing a database connection

 *  [Playsterr](https://wordpress.org/support/users/playsterr/)
 * (@playsterr)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/receiving-error-establishing-a-database-connection/)
 * Hello dear community.
    I have migrated my WP site to another hosting today. Unfortunately
   now I am receiving “Error establishing a database connection” message.
 * Yes, **I HAVE READ Moving WordPress Guide** and done everything according to 
   codex. But still, my WP site is down due to Database error.
    Please, help me 
   guys!
 * My website is [http://playsterr.com](http://playsterr.com)
    My inportant WP-Config.
   php lines: define(‘DB_NAME’, ‘MYDATABASENAME’); define(‘DB_HOST’, ‘127.0.0.1’);
   define(‘WP_SITEURL’, ‘[http://&#8217](http://&#8217); . $_SERVER[‘SERVER_NAME’].‘/’);
 * IMPORTANT:
    I have migrated from a shared hosting to a cloud hosting. So my team
   was installed ftp, phpmyadmin, etc manually. Maybe it matters for some settings,
   I don’t know. Also, one moment. I have SUPER CHACHE PLUGIN Installed. And this
   thing creates define line and database tables too. Don’t know if it matters.
 * Please guide me what to do in order to make my site live.
 * Thank you in advance.

Viewing 15 replies - 1 through 15 (of 15 total)

 *  [kmessinger](https://wordpress.org/support/users/kmessinger/)
 * (@kmessinger)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/receiving-error-establishing-a-database-connection/#post-7258678)
 * There has to be an error in the wp-config.php file.
 * Why is define site url there? Have you tried “local host”? Who is your host?
   
   Because this, [http://127.0.0.1/](http://127.0.0.1/) is wrong.
 *  Thread Starter [Playsterr](https://wordpress.org/support/users/playsterr/)
 * (@playsterr)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/receiving-error-establishing-a-database-connection/#post-7258690)
 * Yes, my take is WP-Config.php mistake somewhere.
 * >Why is define site url there?
    Well, it has always been there. Worked all the
   time.
 * >Have you tried “local host”?
    Yes. Just have tried it but still same database
   error.
 * >Who is your host?
    Vultr [https://www.vultr.com/](https://www.vultr.com/)
 * >Because this, [http://127.0.0.1/](http://127.0.0.1/) is wrong.
    Already changed
   to localhost. Still same error.
 * Anithing else to look and fix?
 * Thank you.
 *  [keyalea](https://wordpress.org/support/users/keyalea/)
 * (@keyalea)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/receiving-error-establishing-a-database-connection/#post-7258699)
 * Have you looked at what is says under “Set Database Host”? [https://codex.wordpress.org/Editing_wp-config.php#Set_Database_Host](https://codex.wordpress.org/Editing_wp-config.php#Set_Database_Host)
 * For most websites localhost works, but if you look at the list, your new host,
   Vultr, is not listed. If localhost does not work, you should contact your host
   to get the name of the database host and see if a port needs to be added.
 * And just to make sure that everything is covered, you did create a new database
   on the new host? When moving to a new host, a new database must be created. You
   also need to create a user and designate a password for the user to access the
   database.
 * If those things are done and you have the correct values, your site should be
   able to connect to the database.
 *  Thread Starter [Playsterr](https://wordpress.org/support/users/playsterr/)
 * (@playsterr)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/receiving-error-establishing-a-database-connection/#post-7258701)
 * There is somethin else.
 * 1. DB_HOST
    I currently use ‘localhost’ value but this could be wrong. In the
   CODEX we see that the host values variate [[Table of different host names](https://codex.wordpress.org/Editing_wp-config.php#Possible_DB_HOST_values)].
   Probably it makes sense to contact my hosting and ask them which host name should
   I use in the config php file. Any ideas which one does vault hosting use?
 * 2. DB_Password
    Another my weak side is the password. I use this field as empty
   in my config while while I find there is a password for my Database User in PhpMyAdmin.
   Maybe I should do something about it and change or set as nopassword for both
   config and phpmyadmin user?
 * That is all progress I’ve got by now. Still Database error.
    Any ideas and advises
   are more then welcome.
 * Thank you all.
 *  [kmessinger](https://wordpress.org/support/users/kmessinger/)
 * (@kmessinger)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/receiving-error-establishing-a-database-connection/#post-7258702)
 * Where did you get this, [http://127.0.0.1/](http://127.0.0.1/) If you try to 
   connect to that, you can’t, so this should be your problem.
 *  Thread Starter [Playsterr](https://wordpress.org/support/users/playsterr/)
 * (@playsterr)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/receiving-error-establishing-a-database-connection/#post-7258703)
 * keyalea,
    Hey there! Thank you very much for your contribution! Yes, I am already
   trying all you have advised and hope this gonna work. I will come back soon with
   updates.
 * Thank you again.
 *  Thread Starter [Playsterr](https://wordpress.org/support/users/playsterr/)
 * (@playsterr)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/receiving-error-establishing-a-database-connection/#post-7258704)
 * kmessinger,
    It’s already fixed to localhost value. 🙂
 *  [kmessinger](https://wordpress.org/support/users/kmessinger/)
 * (@kmessinger)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/receiving-error-establishing-a-database-connection/#post-7258706)
 * > Password. I use this field as empty in my config
 * You have to have a password.
 *  Thread Starter [Playsterr](https://wordpress.org/support/users/playsterr/)
 * (@playsterr)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/receiving-error-establishing-a-database-connection/#post-7258713)
 * Hey guys!
    Good news here! It was about DB_PASSWORD field. I added new password
   in phpmyadmin and duplicated it into wp-config and now my site is online now.
 * THANK YOU SO MUCH DEAR VOLUNTEERS!!! I am really happy.
 * Well. Almost. Another thing now does not work. It is links of my WP site. All
   links are broken are returning ‘Not Found’ message. 🙁
 * You can check this on my website [LINK](http://playsterr.com/)
 * Any ideas and guides how I can fix it?
    Thanks guys.
 *  [kmessinger](https://wordpress.org/support/users/kmessinger/)
 * (@kmessinger)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/receiving-error-establishing-a-database-connection/#post-7258717)
 * You will be better off posting a new topic for support and closing this one out.
 *  [keyalea](https://wordpress.org/support/users/keyalea/)
 * (@keyalea)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/receiving-error-establishing-a-database-connection/#post-7258721)
 * Great to hear.
    Your website is not routing properly. It looks like you need 
   to replace all your base URLs with the domain name. For example, all your links
   should be following the pattern: [http://playster.com/normal-lost-phone/](http://playster.com/normal-lost-phone/)
   but instead are: [http://107.191.40.214/normal-lost-phone/](http://107.191.40.214/normal-lost-phone/)
 * In the admin panel, under Settings – General, do you have your domain name in
   the WordPress Address URL: and the Site Address URL?
    Try that, and if it works,
   mark this ticket as resolved. If it doesn’t work, open a new ticket. Thanks!
 *  Thread Starter [Playsterr](https://wordpress.org/support/users/playsterr/)
 * (@playsterr)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/receiving-error-establishing-a-database-connection/#post-7258724)
 * Now bad news. Really really bad news.
    I have changed my domain name from IP 
   to playsterr, exactly what keyalea said. And BOOM! Now again receiving ‘Error
   establishing a database connection’ message. What is really WORSE I cannot now
   enter my PhpMyAdmin using my user name and password. It says nothing but not 
   letting me in.
 * I have no idea what has happened. But I am pretty sure it happened right after
   I changed domain name in my wordpress admin panel. However it should work fine,
   why happened so?
 * I DEFINITELY have not changed any phpmyadmin settings, especially user/pass credentials
   but looks like it was changed somehow. Now I have database error message and 
   cannot enter phpmyadmin.
    I am totally out of idea what happened and how can 
   I fix it.
 * Any ideas, guys?
 *  [keyalea](https://wordpress.org/support/users/keyalea/)
 * (@keyalea)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/receiving-error-establishing-a-database-connection/#post-7258733)
 * You have conflicting settings that were set. You should be able to access your
   site through your new host vultr if you can’t any other way. Do the settings 
   in the wp-config file match what your site is intended to be? If all settings
   match, then all should be good. If they don’t match, or if values are something
   that they are not supposed to be, then things go wrong.
 * Make sure that you have set usernames and passwords. Earlier you wrote that you
   didn’t set a password. In the interim, it may be possible that because this is
   a public forum, your site may have been hacked if the password was changed by
   someone else other than you. The Internet is publicly accessible to anyone that
   can access it. It’s really important to set and use strong passwords with any
   account.
 *  Thread Starter [Playsterr](https://wordpress.org/support/users/playsterr/)
 * (@playsterr)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/receiving-error-establishing-a-database-connection/#post-7258737)
 * keyalea
    Hm, yes, I have access to my hosting, ftp, website files and wp-config.
   I checked config, it is okay now, should be working. I don’t think I was hacked
   or something. It looks like I accidentaly ran into some VPS hosting configuration
   issues. I don’t think I was hacked or something. More likely some VPS configuration
   troubles. I guess I should apply for some admin server help.
 *  [kmessinger](https://wordpress.org/support/users/kmessinger/)
 * (@kmessinger)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/receiving-error-establishing-a-database-connection/#post-7258804)
 * >  But I am pretty sure it happened right after I changed domain name in my wordpress
   > admin panel.
 * This gives various ways to correct the domain name some of which do not involve
   using the dashboard.
 * [https://codex.wordpress.org/Changing_The_Site_URL](https://codex.wordpress.org/Changing_The_Site_URL)

Viewing 15 replies - 1 through 15 (of 15 total)

The topic ‘Receiving Error establishing a database connection’ is closed to new 
replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 15 replies
 * 3 participants
 * Last reply from: [kmessinger](https://wordpress.org/support/users/kmessinger/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/receiving-error-establishing-a-database-connection/#post-7258804)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
