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 [client] user = root password = qweqweqwe host = localhost EOF $ chmod 600 .my.cnf
- The first command is for having root privileges.
- The second command creates a file called .my.cnf (it MUST be this exact name) with a really straightforward configuration.
- 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!