You've two machines:
- A: the machine on which Apache resides. IP address 10.0.0.2
- M: the machine with the MySQL database. IP address 10.0.0.3
In a default MySQL installation, MySQL listens on all interfaces and thus, other machines can reach it on it's public (network) IP address on port 3306 (default port or MySQL).
To allow A to connect with M, a MySQL account should be present on M allowing
email@example.com to connect with MySQL (user =
accountname). In your webapp on A, use hostname 10.0.0.3, username accountname and a password as set for
If there is a firewall on M, be sure to allow incoming connections to TCP port 3306 on M.
Assuming your webapp uses PHP as language, replace something like:
$oCon = new MySQLi('localhost', 'accountname', 'password', 'database');
$oCon = new MySQLi('10.0.0.3', 'accountname', 'password', 'database');