You probably know that
mysql -h host_or_ip can connect you to a remote host.
But did you know that you can change the host you are connected to from within
The undocumented (as far as I can tell, in the MySQL manual and in the “help” on the mysql command line)
CONNECT statement can help.