MySQL Tutorial
Introduction 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 PHPMyAdminData control language in MySQL
Examples of DCL commands include:- GRANT to allow specified users to perform specified tasks.
- REVOKE to cancel previously granted or denied permissions.
- CREATE
- SELECT
- DROP
- DELETE
- INSERT
- UPDATE
- GRANT OPTION
GRANT SELECT ON deals.* TO ‘adam’@’localhost’;
FLUSH PRIVILEGES;
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 ALL PRIVILEGES ON *.* TO ‘adam’@’localhost’;
FLUSH PRIVILEGES;
You can check the privileges of any user by executing below command.
SHOW GRANTS FOR ‘adam’@’localhost’
To view grants of current user, execute below query.
SHOW GRANTS
To Grant File privilege, you need to execute below statements.
GRANT FILE ON . to ‘adam’@’localhost’
FLUSH PRIVILEGES;
Web development and Automation testing
solutions delivered!!