It’s still fresh in memory, so I thought of blogging it right away. A couple of minutes back while migrating hacklog.in on the new VPS, I had some trouble restoring it’s db. I dumped all the databases from the old VPS and restored on the new one without error warnings. I assumed everything went fine. But the site, i.e hacklog.in would not show up. Instead it would display “Error establishing database connection”.

I checked … and yes I was not able to log in MySQL using the db account. The user entry was there but it would still show error when logging.

Finally, to get around I just had to delete the user and recreate again, granting all privileges.

delete from mysql.user where user=’urUsername’;  
delete from mysql.db where user=’urUsername’;

grant all privileges on urDatabase.* to ‘urUsername’@’urHost’ identified by ‘urPassword’;

flush privileges;  

The site was back smiling again!