How to give user privilages for a db. Login as root. Switch to the MySQL db. Grant privs. Update privs

# mysql -u root -p

# mysql -u root -p

mysql> use mysql;

mysql> INSERT INTO user

(Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv) VALUES (‘%’,’databasename’,’username’,’Y’,’Y’,’Y’,’Y’,’Y’,’N’);

mysql> flush privileges;

or

mysql> grant all privileges on databasename.* to username@localhost;

mysql> flush privileges