josh_mcq — 2011-05-04T23:41:18-04:00 — #1
I created a beautiful site(as much as a developer's first database-driven site can be), and I purchased hosting through Bluehost, I moved all my files over to BlueHost, and then when I go to my site (www.mcquistonator.com/coffeejoint), it gives me:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in /home7/mcquist1/public_html/coffeejoint/includes/connection.php on line 3
Database connection failed: Access denied for user 'root'@'localhost' (using password: YES)
I'm guessing that this is something that can be fixed quite easily. But I think it also points to a concept I'm still in the dark on. I figured out how to install WAMP, and set up my database through PHP MyAdmin, and then write the PHP code to talk to the DB when it was all being stored and accessed from my pc. But now that I'm going "live" on the web, when I transfer all my files, how does the data in the database get there? I don't have any files with that data, or I guess they are not in with all the HTML, PHP, and CSS files.
I looked back thru my sitepoint book "building a database driven website" and I'm not finding any obvious section that tells me how to set up the "online" database.
What big, obvious thing am I missing?
ralphm — 2011-05-04T23:56:22-04:00 — #2
You need to go back into PHPMyAdmin and save a copy of your database and upload it to your web server, probably through a similar interface that has something like PHPMyAdmin. What kind of control panel does Bluehost have? The database also needs to set up on the live server, just like you did it through WAMP.
starlion — 2011-05-05T09:54:34-04:00 — #3
Also, because you wont have access to root@localhost on your hosted server's mySQL, you'll need to tweak your database connection string in your PHP files to whatever username and password you set up in your host's control panel.
dr_john — 2011-05-06T17:32:57-04:00 — #4
Many hosts show you a sample connection string, based on a database name, user name and password, so you can then adapt your own names to match, as part of their help / support.