MySQL CLI Without Password

Usually this is how to connect to MySQL Server using MySQL client:

$ mysql -u mike -p123

To connect without needed to insert password(and username) every time, we can pre-configure all credentials in .my.cnf file

$ cd ~
$ touch .my.cnf
$ vi .my.cnf

… and insert and save the following value:

[client]
user=mike
password=123

Now you can connect to MySQL Server by simply type mysql:

$ mysql

comments powered by Disqus