After a lot of trials I found the following solution.
This will work if you copied all phpmyadmin files in /var/www
go to your copied location of phpmyadmin folder in /var/www
copy the config.sample.inc.php file as config.inc.php
edit in config.inc.php the following line:
$cfg['Servers'][$i]['AllowNoPassword'] = true;
(In original file it was false, change it as true and save it.)
Then you will be able to login phpmyadmin without password.