I'm currently using MySQL and would like to test MariaDB.
I only have one server, and don't wish to overwrite the current MySQL instance.
Is it possible to have both MySQL and MariaDB to coexist within the same environment?
How can I define the mysql client on which db to connect to? by port?
Yes, it is. Just as two MySQL instances can coexist. MariaDB is still a drop-in replacement.
By port or by different socket path, and install MariaDB to a non-standard directory.
This article on dev.mysql.com has details of how to run multiple MySQL instances on a single server. The instructions are also valid for running MySQL and MariaDB on the same server.