Uploading MySQL Database to Server

- General Comments.

Moderators: Voice Dax, Voice Aeneas

Uploading MySQL Database to Server

Postby Atticus Forghon » Tue Sep 08, 2009 2:41 pm

I used phpMyAdmin to build a sample MySQL database and was able to access it on my local computer (localhost) but I can’t get it on the server hosting our website. All I did to move it from localhost to our site was change the hostname from localhost to www. vcsi.org in the php script and the sql database file and then upload both files to the server via ftp. I get the following error message when trying to access the page that pulls info from the database.

Failed to connect to MySQL Server. Error: Access denied for user 'root'@'(ip address was here)' (using password: YES)

I should say that I am not in charge of the server hosting our site, but was told php w/ safe mode is enabled and that the only databases that wouldn't work on the server are Asp.net and Vb.net. I have looked hard to find an answer but no luck so far so either I am just a complete moron or this is super complicated. I hope its the first one. Any help is appreciated, thanks!
Atticus
Dark Fellowship
§otEP Forever
User avatar
Atticus Forghon
Stablehand
 
Posts: 401
Joined: Sun Oct 06, 2002 5:21 pm
Location: Missouri, USA

Re: Uploading MySQL Database to Server

Postby zenpig » Wed Sep 09, 2009 1:11 am

you can't upload a mysql db via ftp...you can upload a dump of your mysql db from your localhost and via command line(SSH) run the file to populate the db or if your hosting account has some type of control panel it may have something like phpMyAdmin there as well. The db needs to be created via command line if your host allows you such access or via a control panel they provide for some back-end stuff such as db creation....databases have a database name, user, and password for the user and permissions of different levels are granted for access to the db for that user. Your host is the best bet to understand how they have it particularly set up...if they use something like CPanel for a backend for hosting clients to manage their sites I can walk you right through it but there are a ton of different ways your host could possibly have it set up. The dump of your database should include table structure as well as table data so it can build correctly at the database for your hosted site.
"The trouble with socialism is that you eventually run out of other people's money" ~M. Thatcher

If I could buy my reasoning I pay to lose
User avatar
zenpig
Journeyman
 
Posts: 2220
Joined: Wed Sep 25, 2002 5:00 pm

Re: Uploading MySQL Database to Server

Postby Kaz » Sat Sep 12, 2009 7:31 pm

Atticus Forghon wrote:Failed to connect to MySQL Server. Error: Access denied for user 'root'@'(ip address was here)' (using password: YES)


That looks like a PHP database error. You are trying to connect to the database using the root account and password from your home server. You'll need to edit the connection string so that it uses a mysql user account on the new server.

You'll have something like this in your code

$connect = mysql_connect('IPaddress', 'root', 'rootsoldpassword');

Change it to something appropriate for the new server. Also, you would be better off connecting to localhost rather than an ip address. Unless the database is on a different server of course.

$connect = mysql_connect('localhost','user','userpassword');

On another note, I'd definatly not run your database access via the mysql root account.
Programming is 10% science, 25% ingenuity and 65% getting the ingenuity to work with the science.
TEN, TMP, Peace, Fervent, LA, sLAinte
Table Warfare Miniatures
User avatar
Kaz
Retired Admin
 
Posts: 3873
Joined: Wed Sep 25, 2002 5:00 pm
Location: The Vinyards of Fernabergia

Re: Uploading MySQL Database to Server

Postby Atticus Forghon » Thu Sep 17, 2009 4:28 pm

Ok, I was able to FINALLY get it working, the server admin finally responded to my emails, he set up a db name, user, and pass for me. I can do everything I need to using php code in regards to performing sql statements but I can't figure out how to use phpmyadmin to access, modify, etc the database. I have done all I can think of and all the options I found online with no success. I suppose its not absolutely imperative that I get it work with phpmyadmin but if I could that would be very helpful. The server admin is not very helpful or timely in his responses so if possible I would like to take of this myself (with your help of course :wink: ). I feel like I gotta beg and plead to get this guy to give me the tiniest amount of information, I have told him through numerous emails that I am new to the database aspect of web design so I need maybe more information than the veteran developer, but yet he gives me the absolute minimum time and time again and I just hate have to keep going back for more help time and time again. Anyways I'm rambling, I'm happy it functions now but pissed at that guy for no help.
Atticus
Dark Fellowship
§otEP Forever
User avatar
Atticus Forghon
Stablehand
 
Posts: 401
Joined: Sun Oct 06, 2002 5:21 pm
Location: Missouri, USA


Return to Comments

Who is online

Users browsing this forum: Google [Bot]

cron