It's a simple thing really. But I can't solve it so I'm hoping someone will quickly give me the answer.
I got two separate servers. The MySQL database is hosted on server #1, and the PHP files on that server are running the website by making queries. Now I'd like to have the same content on website #2, by accessing the same database remotely and running the DB queries.
I have given the remote IP access to the DB on server #1. I have copied the same PHP file (which is making the queries on server #1) to server #2 and changed 'localhost' to IP address of that server. The username and the password remained the same.
When I run that PHP file I get a message "Database NOT found".
This is the PHP code which accesses the database on server #1, the same server where the database is:
$user_name = "database_xxx";
$password = "xxx";
$database = "database_name";
$server = "localhost";
And this is the second case, the PHP file on server #2 which is supposed to access the same database:
$user_name = "database_xxx";
$password = "xxx";
$database = "database_name";
$server = "xx.xxx.xxx.xxx"; //IP address of server #1