how to create mysql user and grant all privileges to database

Below are the steps to create mysql user and grant all preveliges to database

///////////////////////////////////////////////////////////
///create mysql user and grant all preveliges to database//
///////////////////////////////////////////////////////////

//login to mysql commandline 

mysql> CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';

////////// give all database access////////////////////////
mysql> GRANT ALL PRIVILEGES ON * . * TO 'username'@'localhost';

////////// give specific database access with all tables///
mysql> GRANT ALL PRIVILEGES ON databaseName.* TO 'username'@'localhost';

// give specific database access with specific tables//////
mysql> GRANT ALL PRIVILEGES ON databaseName.tableName TO 'username'@'localhost';

mysql> FLUSH PRIVILEGES;

///////////////////////////////////////////////////////////
///create mysql user and grant all preveliges to database//
///////////////////////////////////////////////////////////