MySQL TutorialIntroduction Installation of MySQL Getting MySQL server information RDBMS Concepts Data Definition Language Data types Managing Databases Managing Tables Managing Views Inserting records in a table Updating records in a table Deleting records from a table Retrieving Records Data Control Language Variables in MySQL Procedures in MySQL Built-In functions in MySQL User Defined functions in MySQL Triggers in MySQL Cursors in MySQL Transaction control Event scheduler Tuning MySQL Server Performance Managing users Importing and Exporting data Database Testing Workbench PHPMyAdmin
Data control language in MySQLExamples of DCL commands include:
- GRANT to allow specified users to perform specified tasks.
- REVOKE to cancel previously granted or denied permissions.
- GRANT OPTION
Note that above privilege will allow adam to only use SQL queries on the tables in deals database. If user tries to delete, update or insert records in the table, he would get error saying access denied. To grant all privileges on all database schemas and tables, you can use below syntax.
GRANT SELECT ON deals.* TO ‘adam’@’localhost’; FLUSH PRIVILEGES;
You can check the privileges of any user by executing below command.
GRANT ALL PRIVILEGES ON *.* TO ‘adam’@’localhost’; FLUSH PRIVILEGES;
To view grants of current user, execute below query.
SHOW GRANTS FOR ‘adam’@’localhost’
To Grant File privilege, you need to execute below statements.
GRANT FILE ON . to ‘adam’@’localhost’ FLUSH PRIVILEGES;
Complex problems, Simple Solutions