Please see:
https://docs.moodle.org/39/en/Database_transfer
I have used once ... DB server to which you are migrating has to have DB port (3306) opened in server firewall *and* in the config of the DB server to which you are migrating must allow the IP address of the sending server grants/permissions to create a new DB.
So ... on server from which you are migrating, suggest doing an nmap scan
nmap -P0 -p 3306 IPaddressofserver/to/which/you/are/xfering
IF response is closed ... must open that port on the destination server's firewall (operating system firewall).
Plus ... the destination DB server must allow the user being used to connect to it, permissions to create a new DB as well as xfer the data to it.
So from current server, a quick test:
mysql -h IPaddressofdetinationserver -u root -p
You will be prompted for it's root password.
If you give that correctly, your mysql prompt will appear.
Test by creating a database:
mysql> create database testing;
If that fails, destination DB server needs to be config'd so user being used can create and xfer data.
Note: you might be better off just doing an SQL dump from current. XFer the sql dump file to new server, then import.
You might specific MySQL DB info ... per version ... at dev.mysql.com (assuming MySQL DB servers are involved).
https://dev.mysql.com/doc/refman/5.7/en/
If 5.6 change version number above ... ditto if version 8!
'SoS', Ken
Thank Ken. I am going to work on this following your criteria and advice.
"SoS', Ken
PHP 7.2.30, MariaDB 10.2.31 on my VPS, PHP Version 7.2.8 & MySQL 5.7.23 on my MAMP.
When I do move the database from VPS to MAMP, I always drop the mySQL tables first. Not sure if this makes any difference.