Error Establishing a Database Connection

Status
Not open for further replies.

prototy9

New Member
Messages
7
Reaction score
0
Points
1
Hi, I've been working on a blog for myself locally using Wordpress on XAMPP, and decided to put it online to test my domain. This was the first time that I actually did a transfer, and I used Cyberduck to do so.

Now, when trying to go to my main site directory, i get the Error Establishing a Database Connection in all bold. But when I try to log into wp-admin, I get the same error, but with more information:

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?

I've surfed the web and troubleshooted this problem for about 4 hours now and can't seem to get it to work no matter what I do. A few things that I did was:

Try to change the DB configurations in the wp-config file, to match my MySQL database configurations. I am using xhosting (free), and I've seen people say use localhost and I've seen people say use mysql.xhosting, but neither has worked for me so far, unless I missed the right combination while messing with the file (doubt it).

Can this problem be due to something in wordpress itself, or something that I am just missing with wp-config? Like I said, I've never done this before, so I could have missed something simple.

All help will be greatly appreciated! Thanks guys.

P.S. my website url is : iambey.com

EDIT: I forgot to mention, the website still works locally using XAMPP, so the problem definitely happened somewhere while transferring it to the live server.
 

Anna

I am just me
Staff member
Messages
11,736
Reaction score
578
Points
113
Took a quick look, appears you have not filled in a database password into wpconfig.php, that is something you would need to be able to make a connection with the database server.
 

prototy9

New Member
Messages
7
Reaction score
0
Points
1
Oh I see, that's even if there wasn't one initially when working locally? Is there a specific pw that must be placed there or can I just make one up?

I really hope that is the problem though, thanks for your help. I'm not at my computer at the moment so I will post an update when I get back home!
 

Dead-i

x10Hosting Support Ninja
Community Support
Messages
6,084
Reaction score
368
Points
83
Hi,

This would be the password that is associated with the MySQL user you created. If you can't remember what password you chose, you can reset the password by clicking "Set Password" at the very bottom of the "MySQL Databases" page in cPanel. ;)

Thank you,
 

prototy9

New Member
Messages
7
Reaction score
0
Points
1
Thanks for the help guys, the password was the problem! Now i have two more issues:

1. The site that shows is not the site that I've been working on. It is un-styled with no unique content. I'm guessing that I didnt FTP properly, but when i look thru the files in Cyberduck, everything is there. (I FTP'd the entire wordpress folder with my themes and plugins folders inside)

2. wp-admin doesn't work. I get a 500 Internal Service Error when I try iambey.com/wp-admin, and a Not Found Error (404 Not Found) when I try iambey.com/wordpress/wp-admin. I dont think the latter is the proper way to do it, but I tried it anyway.

Do you guys have any idea what my two problems are?

Thanks!
 

Dead-i

x10Hosting Support Ninja
Community Support
Messages
6,084
Reaction score
368
Points
83
Hi prototy9,

Please could you ensure that the Site URL in WordPress is set correctly? You can usually set this from the "General" part of your WordPress Settings.

You might be able to sign in to WordPress at: http://iambey.com/wordpress/wp-login.php

If you can't sign in there, there are alternative methods of setting your site URL. Please see this article for more information:
https://codex.wordpress.org/Changing_The_Site_URL

Thank you,
 

prototy9

New Member
Messages
7
Reaction score
0
Points
1
That post worked for the second problem. I can now use wp-admin to log in. But the first problem still persists. I checked the FTP files thru cPanel on xhosting, and Cyberduck, and the files are the same as the ones on my Localhost through XAMPP. My local site is up to date with the stylings/plugins, but my live site seems to be a very early stage; like day 1. I can't find why this is happening, because I FTP transferred the site directly from my 'wordpress' folder from xampp/htdocs on my computer, using Cyberduck.

EDIT: I'm not sure if this is significant, but the DB_HOST is set to localhost currently. Thanks
 
Last edited:

AngusThermopyle

Active Member
Messages
319
Reaction score
52
Points
28
Did you export the database from your local machine and import it into your x10hosting database?

All your blog posts, page content, etc is in the database, not the files.
 

prototy9

New Member
Messages
7
Reaction score
0
Points
1
Thanks AngusThermopyle. That was the problem and now I have my site online !:)

I'm still in production for the site, so while i'm making changes, do I FTP the entire site's files again + import/export from my local system, or do I just do one or the other each time I want to make a change live?

Thanks for all the help guys, I would have never figured all of this out on my own :pigeon:
 
Status
Not open for further replies.
Top