Error establishing a database connection

Fadi946

Power Member
Joined
Mar 25, 2009
Messages
621
Reaction score
79
Hello everyone!

I am trying to put my wordpress (from my localhost) into the hosting! I am going to show you a step by step of what I did, and tell me why it is not connecting to the database!

1) I went to my localhost, logged it (username root, no password), exported my tvshows database.
2) Logged in to goDaddy->went to the WebHosting->SQL->Created a Database with the DB name= FadiX, Username = FadiX, Password = FadiY->Imported my tvshows database.
3) Went to File Manager->Removed all the files that I had inside->Uploaded all of my Wordpress Folder. The folder goes like this TV->Wordpress->All the files here. (See Picture)
9384d44436d747daf074e8f3c647af51.webp
4) After uploading all of the files, I went to my wp-config.php->edited it, and this is what it looks like:
4fff73230c65293f577488a36c7ea3c9.webp
(Of course the FadiX and FadiY are not my real username+password+DBname.. just changed it for the example)

Now when I go to my website, I get a Database error:
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.

  • Are you sure you have the correct username and password?
  • Are you sure that you have typed the correct hostname?
  • Are you sure that the database server is running?
If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.

I have been trying to fix it at least 30 hours now! No kidding! This is so frustrating! I made a step by step and tried to be very clear just so someone can be nice enought to help!!

I would appreciate it SO FREAKING MUCH if someone will find a solution for me!

Thanks so much!

-Fadi
 
Usually your database name will be something like hostuser_databasename
So godaddy_FadiX or similar, i'm not sure what it is with godaddy. Check that too!
 
GoDaddy usually provides seperate MySQL servers so "localhost" probably is wrong.
Check your hosting CPanel for your correct MySQL address.

Alternatively, GoDaddy could be forcing an alternate table name as most mass providers do so you'll find your username or database name is actually godaddy_fadix.

Let me know how you get on.
 
You need to replace the DB_HOST with some value(usually an url and not localhost) which you can get it from phpmyadmin where the host will be mentioned. It won't be localhost if it's not a VPS or dedicated server.
 
THANKSSSS SOOOOOOO FREAKINGGGGG MUCHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

YOU CAN'T BELIEVE HOW HAPPY I AM RIGHT NOW!! I AM EVEN CAPS LOCKING TO SHOW MY EXCITEMENT!!!

Yesterday I woke up at 8am and slept at 2am only trying to fix this problem! And today I woke up at 7am and now its 1pm finally managed to solve it!!!!!!!

Solution: As you guys said, the DB_HOST, I just changed it to what GoDaddy gave me in the details about my DB!

IF YOU REALLY WANT TO DO SOMETHING, YOU CAN DO IT!! JUST DIG HARD!

THANKS SO MUCH GUYS AGAIN!! YOU ROCK!!!!!!!


EDIT:

I'm sorry guys, can I ask 1 more question?

So after I fixed it, I got it like website.com/tv/wordpress/stuffhere.php
I went to the perma link and changed it from website.com/tv/wordpress to website.com and not I get this error:
No input file specified.
What do I need to do?

btw all my helpers!
 
Last edited:
THANKSSSS SOOOOOOO FREAKINGGGGG MUCHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

YOU CAN'T BELIEVE HOW HAPPY I AM RIGHT NOW!! I AM EVEN CAPS LOCKING TO SHOW MY EXCITEMENT!!!

Yesterday I woke up at 8am and slept at 2am only trying to fix this problem! And today I woke up at 7am and now its 1pm finally managed to solve it!!!!!!!

Solution: As you guys said, the DB_HOST, I just changed it to what GoDaddy gave me in the details about my DB!

IF YOU REALLY WANT TO DO SOMETHING, YOU CAN DO IT!! JUST DIG HARD!

THANKS SO MUCH GUYS AGAIN!! YOU ROCK!!!!!!!


EDIT:

I'm sorry guys, can I ask 1 more question?

So after I fixed it, I got it like website.com/tv/wordpress/stuffhere.php
I went to the perma link and changed it from website.com/tv/wordpress to website.com and not I get this error:
No input file specified.
What do I need to do?

btw all my helpers!

Were it installed in a sub folder?
If so you would need to look in the db where is website.com/tv/wordpress and change it to website.com
just open the sql file in notepad++ and use the search function
 
I have opened my sql using Dreamweaver and replaced everything that contains MyWebsite.com/tv/wordpress to "MyWebsite.com/" but it did not work ><

And yes it is, tv/wordpress are my directories as you could see in my previous images.
 
I have opened my sql using Dreamweaver and replaced everything that contains MyWebsite.com/tv/wordpress to "MyWebsite.com/" but it did not work ><

And yes it is, tv/wordpress are my directories as you could see in my previous images.

did you import it again ? Also check your wp-config file.
 
did you import it again ? Also check your wp-config file.

Yes, I imported it again.
my wp-config file is fine, because I tried importing my old database with the tv/wordpress and it works good.

Edit: Do I have to play with the permalink thing in the settings?
Edit: I decided to re-upload everything without my TV/Wordpress files and see if it will work!
 
Last edited:
Yes, I imported it again.
my wp-config file is fine, because I tried importing my old database with the tv/wordpress and it works good.

Edit: Do I have to play with the permalink thing in the settings?
Edit: I decided to re-upload everything without my TV/Wordpress files and see if it will work!

If you were on our servers, I would've tried to fix it for you.
But without have access I can't really do anything.
Try to check the WP settings and see if there WordPress Address (URL)
 
Back
Top