I'm using the Build your own Database Driven Website using PHP & MySQL to help me learn PHP & mySQL (obviously).

I wanted to create a new user that had limited access to MySql server that I could use in my login.inc.php file. I don't want to use root incase anyone manages to get hold of the login details then they can do what they want to my database.

I created a new user with the following rights delete, insert, lock tables, select, update and file on a specific database.

I used the following command to grant the access setting the user up to be able to login from any computer (I think):

grant privilege on db.*
to user@"%"
identified by 'password';

When I exit mysql and try and log back in using the new users details:

mysql -h localhost -u user -p

I get the following error:
Access denied for user 'user'@'localhost' (using password: YES)

When I put the details in my login.inc.php file it also doesn't allow access to the database.

Can anyone please help?