Now that the root user has a password, it's up to us to make sure the password—and the passwords of all other users we will inevitably create—stay secure. One of the most important ways to do that is to always follow a good connection practice.
When connecting to MariaDB as root, or any other user, we tell the mysql
command line client that we are connecting with a password by using the -p
flag. When we do so we can either specify the password right after the -p
flag with no space between, as shown in the following command line:
mysql -u root -pmypassword
Or we can just leave the -p
flag by itself and the client will prompt us for the password, as shown in the following command line:
mysql -u root -p Enter password:
It is almost never a good idea to type our password on the command line. The reason is because status and system logs may record the command. This is very useful for determining who is connecting and when, but it can be very dangerous as it exposes the password...