sunfire Posted May 20, 2008 Share Posted May 20, 2008 Hello, I have been hitting my head on my desk for the last few hours. I'm trying to connect to a remote MySQL database. I can connect to the one on the localhost but not the remote one. I keep getting the error. Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'dbuser'@'mysql.mydb.com' (using password: YES) I changed the error text of the user and host. The problem is "mysql.mydb.com" is not the server name/host I'm specifting in my php code. It's the FQDN of the localhost. $servername='dbmysql.mydb.com'; $dbusername='dbuser'; $dbpassword='PasswordTextRemoved'; $link=mysql_connect ("$servername","$dbuser","$dbpassword"); if(!$link){die("Could not connect to MySQL");} mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error()); What am I doing wrong, thanks! Tom Link to comment https://forums.phpfreaks.com/topic/106479-cannot-get-mysql_connect-to-talk-to-remote-host/ Share on other sites More sharing options...
BlueSkyIS Posted May 20, 2008 Share Posted May 20, 2008 The problem is "mysql.mydb.com" is not the server name/host I'm specifting in my php code. it sure looks like that is the server name/host that you are specifying in your code: $servername='dbmysql.mydb.com'; $dbusername='dbuser'; $dbpassword='PasswordTextRemoved'; $link=mysql_connect ("$servername","$dbuser","$dbpassword"); Link to comment https://forums.phpfreaks.com/topic/106479-cannot-get-mysql_connect-to-talk-to-remote-host/#findComment-545763 Share on other sites More sharing options...
bilis_money Posted May 20, 2008 Share Posted May 20, 2008 have not you tried localhost? $servername='localhost'; $dbusername='dbuser'; $dbpassword='PasswordTextRemoved'; Link to comment https://forums.phpfreaks.com/topic/106479-cannot-get-mysql_connect-to-talk-to-remote-host/#findComment-545767 Share on other sites More sharing options...
bilis_money Posted May 20, 2008 Share Posted May 20, 2008 some times you need to talk to the SERVER ADMIN. Have you not called the administrator of the server? Link to comment https://forums.phpfreaks.com/topic/106479-cannot-get-mysql_connect-to-talk-to-remote-host/#findComment-545772 Share on other sites More sharing options...
sunfire Posted May 20, 2008 Author Share Posted May 20, 2008 I can access the localhost mysql database, but can not get to the remote mysql database. I have used NaviCat to verify that the user name and password work for the remote mysql database. So I do not think it's a permissions thing. // localhost = mysql.mydb.com $servername='localhost'; // works! // remote db = dbmysql.mydb.com $servername='dbmysql.mydb.com'; // does not work I get the error Thanks, tom Link to comment https://forums.phpfreaks.com/topic/106479-cannot-get-mysql_connect-to-talk-to-remote-host/#findComment-545776 Share on other sites More sharing options...
BlueSkyIS Posted May 20, 2008 Share Posted May 20, 2008 in my web browser, mydb.com looks like it's just a parked domain. are you sure there is a mysql server at dbmysql.mydb.com? Link to comment https://forums.phpfreaks.com/topic/106479-cannot-get-mysql_connect-to-talk-to-remote-host/#findComment-545779 Share on other sites More sharing options...
sunfire Posted May 20, 2008 Author Share Posted May 20, 2008 I changed the error text of the user and host. Link to comment https://forums.phpfreaks.com/topic/106479-cannot-get-mysql_connect-to-talk-to-remote-host/#findComment-545808 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.