What should I do if I want to set MySql access restrictions? The following describes how to set MySql access restrictions for your reference.
We use two methods to set MySql access restrictions. Enter the Mysql execution directory c: \ mysql \ bin ). Enter mysqld-export ware.exe and mysql -- user = root mysql. Otherwise, you cannot add new users. Go to the mysql> prompt to perform the operation.
Suppose we want to create a super user with the username system and user password manager. Method 1: Use the Grant command to grant permissions. The input code is as follows: mysql> grant all privileges on *. * TO system @ localhost identified by \ 'manager \ 'WITH Grant OPTION;
Display: Query OK, 0 rows affected (0.38 sec)
Method 2: set each permission of a user:
Mysql> insert into user VALUES (\ 'localhost \ ', \ 'System \', PASSWORD (\ 'manager \ '), \ 'y \', \ 'y \', \ 'y \', \ 'y \ ', \ 'y \');
For MySQL 3.22.34, there are 14 \ "Y \" in total, and the corresponding permissions are as follows (sorted by field ):
Permission |
Table column name |
Explanation |
Scope of use |
Select |
Select_priv |
Select permission is required only when a table is actually retrieved. |
Table |
Insert |
Insert_priv |
Allows you to Insert a new row into an existing table. |
Table |
Update |
Update_priv |
Allows you to update columns in the row of an existing table with new values. |
Table |
Delete |
Delete_priv |
Allow you to delete rows that meet the conditions |
Table |
Create |
Create_priv |
Allow you to create new databases and tables |
Databases, tables, or Indexes |
Drop |
Drop_priv |
Discard (delete) existing databases and tables |
Database or table |
Reload |
Reload_priv |
Allow you to tell the server to read the authorization table again |
Server Management |
Shutdown |
Shutdown_priv |
This vulnerability may be abused (by terminating the server and rejecting services from other users) |
Server Management |
Process |
Process_priv |
Allows you to view the common text of the currently executed query, including setting or changing the password for the query |
Server Management |
File |
File_priv |
Attackers can exploit this vulnerability to read any readable files from the server to the database table. |
File access on the server |
Grant |
Grant_priv |
Allow you to grant your own permissions to other users |
Database or table |
References |
References_priv |
Allows you to open and close Record Files |
Database or table |
Index |
Index_priv |
Allows you to create or discard (delete) Indexes |
Table |
Alter |
Alter_priv |
Allows you to change the table. You can rename the table to overturn the permission system. |
Table |
If you only have the select, insert, update, and delete permissions when creating a user, you can perform operations only on the existing tables in a data library. now we can create the database we want to use. for example, to create a database named XinXiKu, use the following code:
Mysql> create database XinXiKu;
Display: Query
The preceding MySql access restriction settings are described.
Six Methods for changing the password of MySQL
Common mysql commands in linux
Nine common mysql commands
Full description of permission fields in the Mysql User table
Common MySQL auto-increment Fields