![]() You may also run the SHOW GRANTS statement to verify that the correct privileges have been applied to the user. A user account can be granted roles, which grants to the account the privileges associated with each role. GRANT SELECT, UPDATE, INSERT, DELETE ON db_name.* TO db_userĮxecute the Flush Privileges statement again to apply the changes. In our case, the user should only be able to read, insert, view and delete rows from all tables in a specific database. TO 'hugh''localhost' Query OK, 0 rows affected (0.00 sec) mysql> GRANT GRANT OPTION ON music. Consider an example, which we’ve run when connected to the monitor as the root user: mysql> GRANT ALL ON music. Next, we tell the server to reload the privileges from the grant tables in the MySQL system schema.įinally, grant the required privileges to the user. The GRANT OPTION privilege allows a user to pass on any privileges she has to other users. REVOKE ALL PRIVILEGES, GRANT OPTION FROM db_user You can either specify individual permissions, separated by commas, but since the root user has many privileges, we can revoke them all and grant the required one in another statement. First, we need to create a new user named ' johnlocalhost ' using the following statement: mysql> CREATE USER johnlocalhost IDENTIFIED BY 'jtp12345' Next, execute the SHOW GRANT statement to check the privileges assigned to johnlocalhost using the following query: mysql> SHOW GRANTS FOR johnlocalhost It will give the below output.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |