How to login to MySQL/MariaDB

Logging in as the root MySQL/MariaDB user:
If you use MySQL/MariaDB and want to login to the database via the command line. The commands to execute via your SSH terminal session is:

mysql -u root -p

You will be prompted for your root MySQL/MariaDB password. After you enter your password and hit enter. You should be logged into MySQL/MariaDB as the root user. Please be careful with the commands you execute after you have successfully logged in as the root user.

Logging in as a regular user:
To login as a regular or plain ordinary user. You can just replace the word root with your MySQL/MariaDB username. You will be prompted for the password associated with the username you are logging in as.

mysql -u anotheruser -p