Recommend a Java interview question that I sorted out, true, reliable, and the strongest in the whole network. See: Java Backend Real Interview Questions - Self-study Wizard
Introduction
illustrate
This article introduces all the permissions of MySQL.
View permissions
Order:
SHOW GRANTS FOR '#userName'@'#host';
For example:
common permissions
Increase and change check
SELECT, INSERT, UPDATE, CREATE, INDEX, CREATE VIEW, SHOW VIEW
CRUD
SELECT, INSERT, UPDATE, DELETE, CREATE, INDEX, CREATE VIEW, SHOW VIEW
Encyclopedia of permissions
permissions |
meaning |
global |
database |
surface |
List |
process |
acting |
ALL [PRIVILEGES] |
All permissions. With grant option, other users can be granted permissions less than or equal to this user. |
||||||
ALTER |
Allow users to use the ALTER TABLE statement |
x |
x |
x |
|||
ALTER ROUTINE |
Allow users to change or delete stored programs |
x |
x |
x |
|||
CREATE |
Allow users to create databases and tables |
x |
x |
x |
|||
CREATE ROUTINE |
x |
x |
|||||
CREATE TABLESPACE |
Allows users to create, alter or drop tablespaces and logfilegroups |
x |
|||||
CREATE TEMPORARY TABLES |
Allow users to create temporary tables with CREATE TEMPORARY TABLE |
x |
x |
||||
CREATE USER |
Users are allowed to use the CREATE USER, DROP USER, RENAME USER, and REVOKE ALL PRIVILEGES statements. |
x |
|||||
CREATE VIEW |
Allow users to create or modify views |
x |
x |
x |
|||
DELETE |
Allow users to use DELETE |
x |
x |
x |
|||
DROP |
Allows users to drop databases, tables, indexes and views etc. |
x |
x |
x |
|||
EVENT |
Ability to schedule events using events |
x |
x |
||||
EXECUTE |
Allow users to execute stored procedures/stored functions |
x |
x |
||||
FILE |
Allows the user to read any file in the database directory. SELECT ..INTO outfile and LOAD DATA infile... operations can only be performed with file permissions, but do not grant FILE, PROCESS, SUPER permissions to accounts other than administrators, as there are serious security risks. |
x |
|||||
GRANT OPTION |
Allows users to grant permissions they have to other users (or revoke permissions from other accounts). |
x |
x |
x |
x |
x |
|
INDEX |
Allow users to create or delete indexes |
x |
x |
x |
|||
INSERT |
Allow users to use INSERT statements |
x |
x |
x |
x |
||
LOCK TABLES |
Allow users to use LOCK TABLES on tables with SELECT privilege |
x |
x |
||||
PROCESS |
Allows the user to view all processes using the SHOW PROCESSLIST statement. KILL is also allowed |
x |
|||||
PROXY |
enable user agent |
||||||
REFERENCES |
Allow users to create foreign keys |
x |
x |
x |
x |
||
RELOAD |
Allow users to use FLUSH operation |
x |
|||||
REPLICATION CLIENT |
Allows users to query the location of the master or slave |
x |
|||||
REPLICATION SLAVE |
Allows users to read binary log events from a master using a replication slave |
x |
|||||
SELECT |
Allow users to use SELECT statement |
x |
x |
x |
x |
||
SHOW DATABASES |
Allow user to display all databases |
x |
|||||
SHOW VIEW |
Allow users to use the SHOW CREATE VIEW statement |
x |
x |
x |
|||
SHUTDOWN |
Allow users to use the mysqladmin shutdown command |
x |
|||||
SUPER |
Allows users to use other administrative operations such as CHANGE MASTER TO, KILL, PURGE BINARY LOGS, SET GLOBAL, and mysqladmin commands |
x |
|||||
TRIGGER |
Allow user to use TRIGGER action |
x |
x |
x |
|||
UPDATE |
Allow users to use the UPDATE statement |
x |
x |
x |
x |
||
USAGE |
Connection (login) permission, creating a user, will automatically grant its usage permission (granted by default). This permission can only be used to log in to the database, and cannot perform any operations; and the usage permission cannot be revoked, that is, the REVOKE user cannot delete the user. |