The error is clear: Unless you have an entry for mysql
in your hosts
file, mysql
is not a valid network address.
You need to specify the address of the remote server as the first parameter in your mysql_connect
call.
Please note that the mysql_*
functions are deprecated and it is recommended to switch to PDO or mysqli with prepared statements.