This one bit me in the proverbial recently. Was trying to setup phpmyadmin for a client on a different host to the database. This was installing apparently successfully, but failed after that. I hacked the installer code to and finally figured out that it was grant rights to the user@hostname (not user at IP address). So I changed the installer to lookup the IP and insert this.
This got everything installed, but I was still have some other weird issues.
I finally worked out after looking through the options in my.cnf that ‘skip-name-resolve’ was set. Removed this and the phpmyadmin installer now worked correctly.
Moral: you don’t always have to hack the code to make things work 😉