Create MySQL User and Grant Privileges

Let say that you wanted to create a MySQL user for example johnpili and assign privileges.
You can do that using the simple code snippet below:

mysql> CREATE USER 'johnpili'@'localhost' IDENTIFIED BY 'Pass2Word3r';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'johnpili'@'localhost';
mysql> FLUSH PRIVILEGES;