xxxxxxxxxx
mysql --host=localhost --user=myname --password mydb
xxxxxxxxxx
mysql -u {username} -p'{password}' \
-h {remote server ip or name} -P {port} \
-D {DB name}
Follow this link to help you
xxxxxxxxxx
https://www.digitalocean.com/community/tutorials/how-to-allow-remote-access-to-mysql