I've used the following to grant all privileges on mydb to myusername:
GRANT ALL PRIVILEGES ON mydb.* to myusername @'%' IDENTIFIED BY 'mypassword';
I thought that the % is a wildcard for all hosts. It worked for a while, but then I had some permission errors when the user tried to access the db from the same machine. I added the following lines:
GRANT ALL PRIVILEGES ON mydb.* to myusername @'localhost' IDENTIFIED BY 'mypassword';
GRANT ALL PRIVILEGES ON mydb.* to myusername @'127.0.0.1' IDENTIFIED BY 'mypassword';
And now the user can access the database.
What does the % stand for? Is there a wildcard for all hosts?

@. Anyway, from the docs:The simple form user_name is a synonym for user_name@'%'.So, just omit the@'hostnamepart. – dezso Oct 14 '12 at 7:40