I have encountered that error with MySQL in the past due to the database login permission.
Try (from command line): mysql -h localhost -u root -p bharat
If that can connect, then, MySQL engine is working okay with your login/password.
If not, then the password could be incorrect or it allows access from other machines except for localhost. I fixed my error by changing my password (bcoz I forgot what it was!).
If you are using the password “bharat”, then is the host or the user different? I am not familiar with the command line utility that you are using.
Didn’t realise you have responded with a “reinstall”. Got pulled away from my desk.
It would have been the MySQL setup. Try adding a piece of the security at a time, eg set password, test RoR. Then allow remote access and test RoR.
There are some HowTos on the MySQL site. If your RoR setup is on the same machine as the database (and you don’t need remote access to administer your database), you can do without remote access.
Try this HowTo for setting up a non-root user for your RoR application. http://dev.mysql.com/doc/refman/5.0/en/create-user.html
You can use http://dev.mysql.com/doc/refman/5.0/en/set-password.html
to help secure your root access.
Same login test applies with different user names and password.