What are the minimum permissions of mysql users?

Source: Internet
Author: User

0 × 00 mysql user permissionsThe root user of mysql has the highest permissions. Run the command to view the permissions of the root user.

Show grants for root @ localhost // view root User Permissions + PRIVILEGES + | Grants for root @ localhost | + PRIVILEGES + | grant all privileges on *. * TO 'root' @ 'localhost' with grant option | grant proxy on ''@'' TO 'root' @ 'localhost' with grant option | + users +

 

As shown in the preceding output, root has all privileges, so we can list all permissions in privileges. You can specify three types of permissions: database/data table/data column permissions: alter: Modify existing data tables (such as adding/deleting columns) and indexes. Create: Create a new database or data table. Delete: Delete table records. Drop: delete a data table or database. INDEX: Create or delete an INDEX. Insert: Add Table records. Select: displays/searches for table records. Update: Modify existing records in the table. Global Management of MySQL user permissions: file: read and write files on the MySQL server. PROCESS: displays or kills service threads of other users. RELOAD: RELOAD Access Control tables and refresh logs. SHUTDOWN: Shut down the MySQL service. Special permissions: ALL: allow to do anything (same as root ). USAGE: Only Logon Allowed-nothing else is allowed. 0 × 01 permission settingsLog on to the root user and create a common user. The username and password are both leesec insert into mysql. user (Host, User, Password) values ('localhost', 'lesec', password ('lesec ')); next, we will set various control permissions on the database or table for the leesec user. 1. for the database leesec, the admin settings of the table only allow the query, modification, and insert permissions grant select, update, and insert on leesec. admin to leesec @ localhost identified by 'leessec '; then we log on to the leesec user and perform the delete record operation ERROR 1142 (42000) on the table admin ): DELETE command denied to user 'lesec' @ 'localhost' for table 'admin' 2. grant the mysql user leesec the permission to delete the table admin grant delete on leesec. admin to leesec @ localhost identified by 'lesec' 3. delete the delete permission revoke delete on leesec of the Mysql user. admin from leesec @ localhost; now you know the minimum permission settings

Related Article

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.