Quick entry. If you are usually connecting to a local or remote mysql database you have to enter the password every single time you enter "mysql". Of course there is a way to configure it in a way that the password is not required:

Let's doit for the root user.

$ sudo -i

$ cat > .my.cnf << EOF

user = root  
password = qweqweqwe  
host = localhost


$ chmod 600 .my.cnf
  1. The first command is for having root privileges.
  2. The second command creates a file called .my.cnf (it MUST be this exact name) with a really straightforward configuration.
  3. The third command gives a very restrictive permissions to the file. Maybe this is not required for the root user since the "others" don't have lecture permission over /root, but if you are creating this file in you daily user you want to protect the file.

And basically, this is it! If you type "mysql" no password is required!