Welcome to the forums data,
3 things mainly.
1) you change the hostname that you are connecting to. usually you connect to 'localhost', but to connect to remote machines you must put the server name instead
2) mysql has to be configured to allow access from any non-localhost users.
3) the user you are connecting with has to be allowed to connect from a non-localhost machine.
Is the database on a computer you own, dedicated server or shared server? If a shared server, it's hit and miss as to whether you are allowed non-localhost connections.