MySQL User management

Source: Internet
Author: User

1.mysql database table structure 1) All tables for MySQL database:

2) Structure of the user table

3) DB table structure
4) Permissions table (Tables_priv and Columns_priv table) ①TABLES_PRIV table structure:
②COLUMNS_PRIV Table Structure:
6) PROCS_PRIV Table structure

2. Account management 1) log in to MySQL using the command line command
2) New user ① new user with Grant user statement
② Adding users using INSERT statements
③ using the GRANT statement to create a new normal user
3) Delete User ① Use the DROP USER statement to delete users
② Deleting a user using the DELETE statement

4) root Modify your password ① use the Mysqladmin tool to change the password (note: the password must be enclosed in double quotes)
② using the UPDATE statement to change the user table
③ using the SET command to change the password
5) Root user to modify the password of the ordinary user ① with the SET command to modify the password (change password to Yunshu, password to enclose in double quotation marks, with single quotation marks will be a problem ② use the UPDATE statement to change the user table
(Change Password to password
③ changing the password with the GRANT statement (change Yunshu password to Sercet
6) Ordinary users to modify their own password ① use the SET statement to modify
② Use the Mysqladmin tool to change the password (password Yunshu cannot be followed by a semicolon, otherwise the semicolon will be treated as a password
7) root user password loss Resolution ① start the MySQL service with the--skip-grant-tables option Windows:mysqld--skip-grant-tablesmysqld-nt--skip-grant-tablesnet start MySQL--skip-grant-tablesLinux:mysqld_safe--skip-grant-tables user=mysql/etc/init.d/mysql Start--mysqld --skip-grant-tables② using the UPDATE statement to modify the password, load the permissions table example: (log in MySQL, no password can be logged in at this time (cannot use the SET statement to modify the password
(Modify the password with the UPDATE statement and load the permission table with flush privileges
(Login again, ok!
3. Rights Management 1) The Permissions column of the user table
2) Authorization syntax: Grant Priv_type [(column_list)] on database.table to user [identified by [PASSWORD] ' PASSWORD '] [, User [Iddentifie D by [PASSWORD] ' PASSWORD '] ... [With With_option [with_option] ...] With_option parameters: A, Grant OPTION: Authorized users can assign these permissions to other users, B, Max_queries_per_hour_count: Set each hour to perform count queries; c, max_updates _per_hour_count:set each hour to perform count updates;D, Max_connections_per_hour_count:set up count times per hour to connect;E,Max_user_connections_per_count: Sets the number of count connections that a single user can have at the same time;Example: (to Yunshu user authorization
(authorized by Yunshu user to YUNSHU2 user
3) The basic syntax of the REVOKE statement that reclaims the permission to retract the specified permission is: REVOKE Priv_type [(column_list)] ... On database.table from user [, user] ... The basic syntax for a REVOKE statement that reclaims full permissions is: REVOKE all privileges,grant OPTION from user [, user] ...
Example:
4) View user Permissions ① View the Users table ② using the show GRANT statement basic syntax: show GRANTS for 'username' @ 'hostname'Example:











From for notes (Wiz)

MySQL User management

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.