MySQL usually uses two methods to set access permissions. First, we enter mysqlexecution directory, mysqld-mongoware.exe, and mysql -- user = root mysql. If you do not enter this sentence, you cannot add a new user. Then go to mysql ''gt and perform the operation at the prompt. If you create a Super User, the user name is system, and the user password is manager.
Method 1
Use the Grant command for authorization. The input code is as follows:
Mysql "gt; 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 "gt; insert into user valueS ('localhost', 'system', PASSWORD ('manager'), 'y ', 'y ', 'y ');
For MySQL 3.22.34, there are 14 "quot; Y" quot; in total. The corresponding permissions are listed as follows (in the order of fields): The permission table column names are used to explain the scope of use.
Select Select_priv the select permission table is required only when a table is actually retrieved.
Insert Insert_priv allows you to insert a new row into an existing table.
Update Update_priv allows you to use the new value to update the columns in the row of an existing table.
Delete Delete_priv allows you to delete row tables that meet the conditions.
Create Create_priv allows you to create new databases and table databases, tables, or indexes.
Drop Drop_priv discard (delete) existing database and table database or table
Reload Reload_priv allows you to tell the server to read the authorization table again. Server Management
Shutdown Shutdown_priv may be abused (by terminating the server and rejecting other user services) Server Management
Process Process_priv allows you to view the common text of the currently executed query, including setting or changing the password query server management.
File File_priv permission can be abused to read any readable files from the server to the database table server for file Access
Grant Grant_priv allows you to grant your own permissions to other user databases or tables.
References References_priv allows you to open and close the record file database or table
Index Index_priv allows you to create or discard (delete) index tables.
Alter Alter_priv allows you to change the table, which can be used to rename the table ** permission system table
If you only have select, insert, update, and delete permissions when creating a user, you can perform operations only on the existing tables of a database.
Next we can create the database we want to use. We can directly enter it. For example, we want to create a database named XinXiKu. The following code is available:
Mysql "gt; create database XinXiKu;
Display: Query OK, 1 row affected (0.00 sec)
- Use the MySQL built-in replication function to optimize the actual operation
- How to lock the MySQL database table?
- High-quality and high-performance compiling of MySQL syntax
- How to master the characteristics of Dynamic tables in MySQL Databases
- MySQL query is optimized by scheduling and locking