MySQL user management analysis

Source: Internet
Author: User

1. MySQL user management
MySQL user information is stored in the mysql user table. Therefore, MySQL user operations are performed on mysql. the addition, deletion, query, and modification operations of the user table show mysql. user table structure:

You can see that all user information, including user name, password, and permissions, can be set in this table. Notice: the password field is generated using the PASSWORD ('') function. In addition to modifying the user table to operate MySQL, MySQL has some additional commands to create or delete MySQL users. Www.2cto.com 2. create user 2.1.CREATE user create user without permission Syntax: CREATE user USER [identified by [PASSWORD] 'Password'] [, USER [identified by [password] 'Password']... example: create user test @ localhost identified by 'test'; // create a user with the user name test and password test. the user does not have any permissions to create a user with the permission in 2.2.GRANT mode. Syntax: GRANT [ALL | [SELECT, DELETE...] privileges on {databasename | *}. {tablename | *}... TO username identified by password; example: grant all privileges on *. * TO test @ % identified by 'test'; 3. delete USER Syntax: drop user username; // username indicates the username with host, that is, test @ localhost. If host is not specified, host is %. example of www.2cto.com: drop user test @ localhost; 4. mySQL permission description 4.1 view the permissions of a user mysql> show grants for root @ localhost; 4.2 permission explanation permission column description CREATE Create_priv CREATE a database and DROP Drop_priv discard (delete) database and table grant option Grant_priv database, table, or stored program REFERENCES References_priv not used ALTER Alter_priv www.2cto.com to modify the table and index delete Delete_priv table INDEX Index_priv create or discard index insert Insert_priv INSERT a new row select_priv: Record UPDATE Update_priv in the retrieval table modify existing table record create view Create_view_priv view show view Show_view_priv view alter routine statement the program create routine statement to save EXECUTE Execute_priv the program FILE File_priv read or write the file "create temporary tables" on the server to manage lock tables Lock_tables_priv server management create user Create_user_priv Server Management PROCESS www.2cto.com Process_priv to view the thread information executed on the server or kill the thread RELOAD reload _ or clear the log, host cache, or table cache replication client Repl_client_priv Server Management replication slave Repl_slave_priv Server Management show databases Show_db_priv Server Management SHUTDOWN Shutdown_priv close server SUPER Super_priv Server Management author sin90lzc

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.