If you have logged into putty as root and you have to monitor the database activity its quiet annoying to enter the MySQL password every time you want to login or run monitoring scripts, we can actually skip entering the password by creating .my.cnf file in /root which is root users home directory

1. Create the .my.cnf file in /root directory

 

vi /root/.my.cnf

 

2. Enter the below information

 

[client]
password='password'

 

Note: Replace the password with MySQL root password.

Now you can login to the MySQL server by just typing mysql and ENTER.