Grant on SQL


- GRANT : Used to grant permissions by the administrator ( principal owner ) server to the user ( regular users ) . Rights such as the right to make such access ( CREATE ) , take ( SELECT ) , delete ( DELETE ) , change ( UPDATE ) , and the special rights with regard to the system database .
- Grant also serves to create a new user and grant privileges .
- Grant used to give privileges to the tables defined to other users .

- Privilege to grant the user the command is defined by using the names of the privileged . Name privilege allows admin to be able to provide privileges without having to know what the field name and the table to be filled .
- Command grant automatically adds user data if the data user names are included on the command is not in the user table . Command allows administrators to grant do not need to do privileged command definition using sql . Because by using sql , we have to memorize the name of the table to be filled , any fields that must be filled , the number of required fields .

General syntax: GRANT <akses> ON [table] TO <user>
   GRANT ALL PRIVILEGES ON [database_name]. * TO 'myuser'
IDENTIFIED BY 'mypassword';
example:
1. GRANT SELECT ON <Field>. [Table] TO user1
2. GRANT ALL PRIVILEGES ON <Field>. [Table] TO user2
3. GRANT ALL ON <Field>. [Table] TO user3
4. SHOW GRANTS FOR Admin;
5. GRANT SELECT, INSERT ON <Field>. [Table] TO [table]

Comments