1/*
2The GRANT statement is used to assign full control over specific database by providing all priviledge.
3Follow below statement for assign priviledge to user
4*/
5
6Syntax:
7GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'localhost';
8
1-- Grants / privileges list
2SELECT * FROM information_schema.user_privileges;
3SELECT CONCAT('SHOW GRANTS FOR ''',user,'''@''',host,''';') FROM mysql.user;
4
5-- Grant a user
6/* ALL PRIVILEGES All privileges
7 CREATE Create databases and tables
8 DROP Drop databases and tables
9 DELETE Delete rows from a specific table
10 INSERT Insert rows into a specific table
11 SELECT Read a database
12 UPDATE Update table rows */
13GRANT SELECT, UPDATE ON db_name.table_name TO 'my_user'@'localhost';
14GRANT SELECT ON *.* TO 'my_user'@'localhost';
15GRANT ALL PRIVILEGES ON db_name.* TO 'my_user'@'localhost';
16
17--Display user grants
18SHOW GRANTS FOR 'my_user'@'localhost';
1/*
2The GRANT statement is used to assign full control over specific database by providing all priviledge.
3Follow below statement for assign priviledge to user
4*/
5
6Syntax:
7GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'%' WITH GRANT OPTION;
8
9/*
10I hope it will help you.
11Namaste
12*/
1GRANT ALL ON *.* TO 'user'@'localhost';
2
3GRANT GRANT OPTION ON *.* TO 'user'@'localhost';