PHP中的远程MySQL连接

I'm beginning to migrate a software project from being a desktop application to a web application. Currently I am using a local PHP/MySQL connection that is associated with the desktop it is installed on.

I'm hoping to untangle this and am trying to create a MySQL database through my 1and1 account. I had no trouble creating a database and recorded my account information. I'd like to be able to edit this database using PHP scripts on my system. However, I haven't been able to get a working connection string going. When I run the following PHP script:

$hostname="db*********.db.1and1.com";
$database="db*********";
$username="dbo*********";
$password="*********";

$link = mysql_connect($hostname, $username, $password);

I get the following error when I run the script in my webbrowser:

Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'db*********.db.1and1.com' (11001) in C:\Program Files\xampp\htdocs\Remote_MySQLightbid_database_initialize.php on line 74
Connection failed: Unknown MySQL server host 'db*********.db.1and1.com' (11001)

How do I get my local system to recognize the 1and1 server host? Am I structuring my connection string correctly? Is it possible to access a remote server from a locally hosted Windows PHP connection?

Thanks!

I assume what's happening if that 1&1 are blocking any connections coming from outside of their network.

Try connecting using

mysql -h HOST -u USERNAME -p DATABASENAME

Good luck

Make sure the MySQL server on 1and1 will accept connections from remote clients. Not just on localhost, and also make sure port 3306 is open to the server.