mysql create a user and grant privileges for particular database only code example
Example: create mysql user with privileges
GRANT type_of_permission ON database_name.table_name TO ‘username’@'localhost’;
GRANT type_of_permission ON database_name.table_name TO ‘username’@'localhost’;