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.
Remark
â â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.
Login mysql from MySQLÂ client
$ mysql -u root -p
Create User with Password
mysql> CREATE USER âpeterâ@â%â IDENTIFIED BY â1234â;
Delete User
mysql> DROP USER âpeterâ@â%â;
Grant PRIVILEGES
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â@â%â;
Revoke PRIVILEGES
mysql> REVOKE ALL PRIVILEGES ON *.* FROM âpeterâ@â%â;
Reload all the privileges
mysql> FLUSH PRIVILEGES;
You may also like
- MySQL Handbook
- [MySQL] Note: Fast Setup and running in Node.js
- [MySQL] Note: Create Admin User
- [MySQL] Note: Database CURD
- [MySQL] Note: Row CURD
- [MySQL] Note: Relation: 1â1, 1-n, n-n, nest
Reference:
https://www.phpini.com/mysql/mysql-add-new-users-databases-privileges