To change the remote listening port of your MySQL or MariaDB server you can edit your database my.cnf file & set the port option to the required port number.
For example:
port 12345
After you have made the necessary changes to the my.cnf file, save it & restart the MySQL / MariaDB server.
For example:
service mysql restart
To check which port MySQL or MariaDB is now listening on run netstat.
For example:
netstat -napt