There are several possibilities, depending on details about what you want to achieve. You need to go through a troubleshooting process to establish where the error is. Assuming that you have some webapp on apache that is attempting to reach mysql on the other machine, here are a few to check to get you going:
- Is mysql running?
- Is mysql configured to listen to TCP sockets?
- Is mysql listening on the external IP address?
- Is mysql authentication/authorisation configured correctly? (in other words, have you created a database/user, granted privileges and is your client offering the correct credentials?)
- Are there any firewalls between client & server?
- Is the webserver/webapp configured correctly?
You might want to consider connecting to the mysql server from the other machine using a command line mysql client, instead of the webapp, in order to help reduce complexities and to help show where the failure is occurring.