The MySQL administrator should know how to set up the MySQL user account and specify which user can connect to the server, where to connect, and what to do after the connection. MySQL 3.22.11 introduces two statements to make this work easier: GRANT statements create MySQL users and specify their permissions, while REVOKE statements delete permissions. The two statements assume the front-end role of the MySQL database and provide a different method than directly operating the contents of these tables. The CREATE and REVOKE statements affect four tables:
Authorization Table content
Users can connect to users on the server and have any global permissions.
Database-level Permissions
Tables_priv table-level Permissions
Columns_priv column-level permission
There are 5th other authorization tables (hosts), but they are not affected by GRANT and REVOKE.
When you issue a GRANT statement to a user, create a record for the user in the user table. If the statement specifies any global permissions (administrative permissions or permissions applicable to all databases), these are also recorded in the user table. If you specify database, table, and column-level permissions, they are recorded in db, tables_priv, and columns_priv tables respectively.
Using GRANT and REVOKE is easier than directly modifying the authorization table. However, read MySQL security guide. These tables are exceptionally important, and as an administrator, you should understand how they go beyond the functional level of GRANT and REVOKE statements.
In the following sections, we will introduce how to set up and authorize a MySQL user account. We also involve how to revoke permissions and delete users from the authorization table.
You may also want to consider using MySQL Access and mysql_setpermission scripts, which are part of MySQL distribution. They are Perl scripts and provide another option to set user accounts for GRANT statements. DBI support is required for mysql_setpermission.
| [Content navigation] |
| Page 1st: MySQL administrator helps you understand the CREATE and REVOKE statements |
Page 2nd: MySQL administrator helps you understand the CREATE and REVOKE statements |