mysql:grant
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
mysql:grant [2022/12/02 21:02] – external edit 127.0.0.1 | mysql:grant [2024/04/24 11:45] (current) – removed rlunaro | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Creating a database user ====== | ||
- | |||
- | When creating a database in mysql, I always prefer to create a user with all the permisions to this database to handling it. Moreover, if you want to use this database through internet, it is advisable to have a second user with more restricted permissions. | ||
- | |||
- | First, here are the instructions to create a database user: | ||
- | |||
- | <code sql> | ||
- | mysql> create user DATABASE_USERNAME; | ||
- | mysql> grant alter, create, delete, drop, index, insert, lock tables, select, update on DATABASE_NAME.* to DATABASE_USERNAME@' | ||
- | Query OK, 0 rows affected (0.00 sec) | ||
- | </ | ||
- | |||
- | The ' | ||
- | |||
- | Second, the more restricted user: | ||
- | |||
- | <code sql> | ||
- | mysql> CREATE USER DATABASE_USERNAME; | ||
- | mysql> grant delete, insert, lock tables, select, update on DATABASE_NAME.* to DATABASE_USERNAME@' | ||
- | Query OK, 0 rows affected (0.00 sec) | ||
- | |||
- | </ | ||
- | |||
mysql/grant.1670014949.txt.gz · Last modified: 2022/12/02 21:02 by 127.0.0.1