MySQL/MariaDB with Credentials File
Using a configuration file for mysql is a good practice as you don't immediately expose credentials. Below, you are going to mysql cli and immediately using the db named dbName.
1mysql --defaults-file=/path/to/credentials.ini dbName
where credentials.ini has this format:
1[client]
2host=<replace_with_servername_or_ip>
3user=<replace_with_db_user>
4password=<replace_with_db_password>
Of course, there are other security precautions you could take, not just the above but it's a good start. See further info on securing mysql in https://dev.mysql.com/doc/refman/8.0/en/password-security-user.html