Two Methods for setting MySQL Access Permissions

Source: Internet
Author: User

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)

  1. Use the MySQL built-in replication function to optimize the actual operation
  2. How to lock the MySQL database table?
  3. High-quality and high-performance compiling of MySQL syntax
  4. How to master the characteristics of Dynamic tables in MySQL Databases
  5. MySQL query is optimized by scheduling and locking

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.