To assign database-level privileges, you use the ON database_name.* syntax, for example: GRANT INSERT ON classicmodels.* The account user can query data from all tables in all database of the current MySQL Server.ĭatabase privileges apply to all objects in a database. TO language: SQL (Structured Query Language) ( sql ) To assign global privileges, you use the *.* syntax, for example: GRANT SELECT ON *.* Global privileges apply to all databases in a MySQL Server. ![]() MySQL supports the following main privilege levels: ![]() Second, specify the privilege_level that determines the level to which the privileges apply. The following example grants UPDATE, DELETE, and INSERT privileges on the table employees to GRANT INSERT, UPDATE, DELETE ON employees TO Code language: SQL (Structured Query Language) ( sql ) This example grants the SELECT privilege on the table employees in the sample database to the user acount GRANT SELECT ON employees If you grant multiple privileges, you need to separate privileges by commas. TO account_name Code language: SQL (Structured Query Language) ( sql )įirst, specify one or more privileges after the GRANT keyword. The following illustrates the basic syntax of the GRANT statement: GRANT privilege. And the GRANT statement grants a user account one or more privileges. To allow user accounts to work with database objects, you need to grant the user accounts privileges. It means that the user accounts can log in to the MySQL Server, but cannot do anything such as selecting a database and querying data from tables. The CREATE USER statement creates one or more user accounts with no privileges. Introduction to the MySQL GRANT statement Summary: in this tutorial, you will learn how to use the MySQL GRANT statement to grant privileges to user accounts.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |