PDA

View Full Version : remote access to mysql


ceejayoz
01-24-2003, 02:05 PM
Hi,

I'm trying to use my dedicated server to function as a mysql server for a remote site. Trying to connect in PHP, however, gives me the following errors. I've edited out some of the details, but you should get the general idea... Warning: Host 'REMOTE_SITE_HOSTNAME' is not allowed to connect to this MySQL server in /usr/cwis/data/sa-data/mif/phpinfo.php on line 3

Warning: MySQL Connection Failed: Host 'REMOTE_SITE_HOSTNAME' is not allowed to connect to this MySQL server in /usr/cwis/data/sa-data/mif/phpinfo.php on line 3

Warning: Access denied for user: 'nobody@localhost' (Using password: NO) in /usr/cwis/data/sa-data/mif/phpinfo.php on line 4

Warning: MySQL Connection Failed: Access denied for user: 'nobody@localhost' (Using password: NO) in /usr/cwis/data/sa-data/mif/phpinfo.php on line 4

Warning: MySQL: A link to the server could not be established in /usr/cwis/data/sa-data/mif/phpinfo.php on line 4 My PHP script is as follows: <?php
mysql_connect("DB_SERVER_HOSTNAME", "USERNAME", "PASSWORD");
mysql_select_db("DB_NAME");
?> In DSM, I've put the hostname of the remote site in the "host" textfield, but that doesn't help. I searched Google and found something about running "FLUSH PRIVILEGES" as root in mysql, but DSM doesn't allow me to do so - no root password.

Any ideas? Am I just doing something really silly?

LeeJ
01-24-2003, 03:01 PM
Use the ip address of the remote site.

Bryan
01-24-2003, 03:12 PM
Make sure that you entered the IP correctly for the host you are connecting from. You can check out the IP of your machine by going to a domain like http://www.whatismyip.com . This will ensure you get the accurate IP address for your remote host entry.

If this information is correct, you should be able to connect with the permissions you set through the MySQL Manager in DSM.

Bryan.

ceejayoz
01-24-2003, 06:09 PM
Using IP address instead of the hostname doesn't change it - the error message still shows "Host 'REMOTE_SITE_HOSTNAME' is not allowed to connect to this MySQL server"

ceejayoz
01-24-2003, 06:12 PM
Got it - for some reason, I had to have BOTH a "localhost" entry and one with the correct IP address for it to work.

Prezident
03-28-2003, 10:16 PM
and how did you get it to accept both a localhost entry, and a remote entry? That is what I would like to figure out.

Any help is greatly appreciated.

Thanks.