I used to be MongoDB addicted, and now I am quitting from it to MySQL for how many apps we want entangled in that way is a business decision but there are tradeoffs on both sides. MongoDB is easy to build sharding, replica and scaling, but designing an complex E-Commerce platform on it is another story.
First thing first, any MySQL operation requires an existed and verified user account. This Note is about a fast configuration of creating usable users for hello-world purpose.
— “The percent sign”, “%” means all ip’s so localhost is superfluous — When an new user is created, who has no permission to anything with the databases. In fact, if newuser even tries to login (with the password, password), they will not be able to reach the MySQL shell. GRANT it before we use it.
$ mysql -u root -p
mysql> CREATE USER ‘peter’@’%’ IDENTIFIED BY ‘1234’;
mysql> DROP USER ‘peter’@‘%’;
This command allows to the user to read, edit, execute and perform all tasks across all the databases and tables.
REVOKE [type of permission] ON [database name].[table name] FROM ‘[username]’@‘%’;
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘peter’@’%’;
mysql> REVOKE ALL PRIVILEGES ON *.* FROM ‘peter’@‘%’;
mysql> FLUSH PRIVILEGES;