Configure MariaDB client with host-specific credentials?
In ~/.my.cnf make sections like:

[clientmy_host_name_1]

[clientmy_host_name_2]


Then make an alias (assuming Linux-like OS - depending on shell, you can perhaps put the alias in ~/.bashrc_local):

alias mysql="mysql --defaults-group-suffix=\`hostname --short\`"


Now you can connect without specifying the password to any of the hosts for which you have stored the credentials in ~/.my.cnf. (These would be my_host_name_1 and my_host_name_2 in my example above.)