I have a couple of connections to each of them going to a different MySQL database, the issue is that one connects to a local server itself, but the other goes to a remote server and under "another port ", I handle the connections like this:
$capsule->addConnection([
'driver' => 'mysql',
'host' => LOCAL_DB_HST,
'database' => LOCAL_DB_NAM,
'username' => LOCAL_DB_USR,
'password' => LOCAL_DB_PWD,
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => ''
], "local");
$capsule->addConnection([
'driver' => 'mysql',
'host' => REMOTE_DB_HST,
'database' => REMOTE_DB_NAM,
'username' => REMOTE_DB_USR,
'password' => REMOTE_DB_PWD,
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => ''
], "remota");
It is important to clarify that I am not using Eloquent as part of Laravel ... but as a fully independent implementation.
The issue is that the remote MySQL server uses a port other than 3306 and I do not know how to tell Eloquent to use another port when connecting to the remote server as long as it retains the default port (3306) for the local connection