mfoster Posted January 25, 2010 Share Posted January 25, 2010 Server: Localhost via UNIX socket Server version: 5.0.87-community Protocol version: 10 User: fultonr1@localhost MySQL charset: UTF-8 Unicode (utf8) I've just moved a domain from one host to another. The script worked fine at the former host. The information on the new host is listed above. I was successful at exporting the database and can work with it through the control panel. However now I don't seem to be able to access the database from my php script. My new host says that it's a programming problem and can't help me. The code (which I copied from w3schools) includes some error analysis which I have included in the script. That code also shows that the mysql_connect seems to be working and is returning Resource Id1. The mysql_select_db command seems to be the problem as it is throwing the following error message: Access denied for user 'fultonr1_mfoster'@'localhost' to database 'fultonr1_entries' You can access the script yourself at http://fulton68reunion.com/view2.php I've checked the database name, username, and password and all seem to be correct. $con = mysql_connect("localhost", "****", "****") ; $db_selected = mysql_select_db("fultonr1_entries",$con); if (!$db_selected) { die ("<br/> Can\'t use fultonr1_entries database : " . mysql_error()); } I/ve included a copy of the file. Quote Link to comment https://forums.phpfreaks.com/topic/189686-having-trouble-connecting-to-mysql-database/ Share on other sites More sharing options...
tinkertron Posted January 25, 2010 Share Posted January 25, 2010 Maybe it's just me, but if I were you I would edit that file and remove any username and password that you have shown in that file. I wish I could help, and I try to look at the php file. Are you sure that you created the db in your MySQL? Is it listed? Quote Link to comment https://forums.phpfreaks.com/topic/189686-having-trouble-connecting-to-mysql-database/#findComment-1001106 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.