Password less MySQL Access

April 30, 2016 by No Comments

Password less MySQL Access

In cPanel servers we can login into mysql as root without providing the mysql root password. It can be accomplished by adding the login credentials in the file “/root/.my.cnf”. Folowing is the syntax for the file.

File : /root/.my.cnf

[client]
user=root
password=mysqlrootpassword

We can set the same file in non cPanel servers also. It uses the credentials set in the file as login details, so if we set user as “admin” in “/root/my.cnf”, it will login as admin user instead of root.

Same can be accomblished under any other users home directory on file “~/.my.cnf”.