EDIT 2:
I think this is not the explanation wanted for the user, but it's possible he needs to populate the information of his master website with a plugin system to the two databases.
If you are going to implement the code by using overrides and custom components, you just have to use, for example, this simple guide to obtain information from the other database:
https://docs.joomla.org/Selecting_data_using_JDatabase
EDIT:
More specifically, you have to create two objects, one for the local connection, and another one to the external connection.
$db = JFactory::getDbo();
$extDb = JDatabaseDriver::getInstance( $option );
And use the same query you create for the two objects:
$query = "UPDATE #__anytable SET column1 = value1";
$db->setQuery($query); $db->execute();
$extDb->setQuery($query); $extDb->execute();
PD: Don't post the credentials like user and password on the internet.