User Tools

Site Tools


mysql:grant

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
mysql:grant [2014/12/24 10:42] – external edit 127.0.0.1mysql:grant [2024/04/24 13: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> 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) 
-</code> 
- 
-The '%' means "from all locations": it gives permissions regardless from where the user is connecting to the database. However, if your database is in your server, and you don't have plans to connect from other locations, you can use DATABASE_USERNAME@localhost as well. 
- 
-Second, the more restricted user:  
- 
-<code sql> 
-mysql> grant delete, insert, lock tables, select, update on  DATABASE_NAME.* to DATABASE_USERNAME@'%'; 
-Query OK, 0 rows affected (0.00 sec) 
- 
-</code> 
- 
  
mysql/grant.1419414127.txt.gz · Last modified: 2022/12/02 22:02 (external edit)