Syntax:
GRANT [type of permission] ON [database name].[table name] TO ‘[username]’@'localhost’;
1. ALL – Allow complete access to a specific database.
If a database is not specified, then allow complete access to the entirety of MySQL.
Examples:
CREATE USER 'sa'@'%' IDENTIFIED BY '1234';
GRANT ALL PRIVILEGES ON *.* TO 'sa'@'%' WITH GRANT OPTION;
GRANT ALL ON *.* to sa@'%' IDENTIFIED BY '1234';
Examples:
GRANT SELECT, INSERT, DELETE,UPDATE ON Databasename TO 'sa'@'1234';
2. CREATE- allows them to create new tables or databases
Examples:
GRANT Create ON TABLE DatabaseName.* TO sa;
3. DROP- allows them to them to delete tables or databases
Examples:
GRANT DROP ON TABLE DatabaseName.* TO sa;
4. DELETE- allows them to delete rows from tables
Examples:
GRANT DELETE ON TABLE DatabaseName.* TO sa;
5. INSERT- allows them to insert rows into tables
Examples:
GRANT INSERT ON TABLE DatabaseName.* TO sa;
6. SELECT- allows them to use the Select command to read through databases
Examples:
GRANT SELECT ON TABLE DatabaseName.* TO sa;
7. UPDATE- allow them to update table rows
Examples:
GRANT UPDATE ON TABLE DatabaseName.* TO sa;
0 Comments