How to create a user

1
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword';

How to delete a user

1
DROP USER 'myuser'@'localhost';

How to grant permissions

1
GRANT ALL PRIVILEGES ON * . * TO 'myuser'@'localhost';

How to apply those permissions

1
FLUSH PRIVILEGES;

Going a bit deeper

Different types of Grants

ALL PRIVILEGES : Full access to everything, globally unless restricted to a database

CREATE : Create databases and tables

DROP : Delete databases and tables

DELETE : Delete rows from tables

INSERT : Insert rows in tables

SELECT : Read data from tables

UPDATE : Update rows in tables

GRANT OPTION : Grant or remote other user’s permissions

How to use them

1
GRANT permission_type ON database_name.table_name TO 'myuser'@'localhost';

How to revoke them

1
REVOKE permission_type ON database_name.table_name FROM 'myuser'@'localhost';

How to show them

1
SHOW GRANTS myuser;