How to enable password-less authentication for mysql root user

Step1: Open a file with name ".my.cnf" in root's home directory.

#vi ~/.my.cnf

Step2: Save the below contents to that file.

[client]
user=root
password=PASSWORD

Here we need to replace "PASSWORD" with the password of mysql root user.

Note that it will be better to set this file readable only for root user

 

Leave a Reply

Your email address will not be published. Required fields are marked *