Database security is a matter of great importance. MySQL databases also have their own security mechanisms. Users must grant MySQL user permission commands to obtain permissions and perform operations.
MySQL can assign strict and complex permissions to different users. Most of these operations can be granted with SQL command Grant permissions) and Revoke permissions) to Grant MySQL user permissions. Grant can assign the specified permission to a specific user. If the user does not exist, a user is created.
Common syntax for granting MySQL user permissions:
Grant permission 1, permission 2 ,... Permission n on database name. Table name to user name @ user address identified by 'Connection password ';
Permission 1, permission 2 ,... Permission n indicates 14 permissions, including select, insert, update, delete, create, drop, index, alter, grant, references, reload, shutdown, process, and file.
When permission 1, permission 2 ,... Permission n is replaced by all privileges or all, indicating that all permissions are granted to the user.
When the database name. Table name is replaced by *. *, it grants the user the permission to operate all the tables in the database on the server.
The user address can be localhost, IP address, machine name, or domain name. You can also use '%' to connect from any address.
The 'Connection password' cannot be blank; otherwise, creation fails.
Priveleges permissions ).
Description
SELECT Table, columns allow users to SELECT Row Records from the table)
INSERT table, columns allow users to INSERT new rows in the table
UPDATE table, columns allow users to modify values in rows in the existing table
DELETE table allows you to DELETE rows in an existing table
The INDEX table allows you to create and drag a specific table INDEX.
Alter table allows you to change the structure of an existing table. For example, you can add a column, rename a column or table, and modify the Data Type of a column.
CREATE Database. Tables allow users to CREATE new databases or tables. If a specific database or table is specified in GRANT, they can only create the database or table, that is, they must first Delete the Drop)
Drop database, table allows users to drag and delete) database or table
Administrator permission description
Create temporary tables allows administrators to use the TEMPORARY keyword in the create table statement.
FILE allows you to read data from a FILE to a table or from a table to a FILE.
Lock tables allow the use of the lock tables statement
PROCESS allows the Administrator to view the server processes of all users
RELOAD allows the Administrator to RELOAD the authorization table, clear the authorization, host, log and table
Replication client allows the use of show status on the Master and Slave servers.
Replication slave allows replication slave servers to connect to the master server
Show databases allows you to use the show databases statement to view the list of all DATABASES. Without this permission, users can only see the databases they can see.
SHUTDOWN allows the Administrator to shut down the MySQL server
SUPER allows the Administrator to close threads belonging to any user
Special Permission description
ALL or all previleges) grant ALL Permissions
USAGE does not grant permissions. This creates a user and allows him to log on, but does not allow other operations, such as update/select.
How to optimize mysql Indexes
How to view MySQL Indexes
Insufficient mysql Indexes
Three statuses of mysql triggers
Create MySQL trigger syntax