If you have a existing MySQL user account that you want to grant permissions to for a specific database, this howto will outline the steps required.
Run the MySQL client:
$ mysql -u root -p
You will be asked for a password. If you don’t have a password set, simply press enter when prompted.
Grant access to the specific database:
GRANT ALL ON databasename.* TO 'username'@'localhost';
Change ‘databasename’ and ‘username’ to suit your requirements.
Flush the privileges to make sure the newly added user and permissions are ready to use:
FLUSH PRIVILEGES;
Exit the MySQL client:
exit
If you need to create a new user, see the following howto:
Create a new user in MySQL