MySQL User management

Source: Internet
Author: User
Tags mysql client

The content of this article:

    • User's introduction
    • View User
    • Create a user account
    • Modify Account
    • Delete Account
    • About Anonymous users

Starting Date: 2018-04-19

User's introduction:

    • The MySQL client connection is logged in as the user name to the server.
    • The server can make changes to the user's permissions, so each user has different permissions to the database or to the data table.
    • In general, you should not use the root user to log in, because the root user has the highest permissions to delete the database and other "dangerous" operations. For security purposes, you should log in with another user and assign him the appropriate permissions.
    • And the user should have a password, using an anonymous user (no password) is very dangerous, if the anonymous user is also open telnet, the other people just detect that your port is open to log on to your MySQL.

View Users:

    • MySQL user accounts and information are stored in MySQL database named MySQL.
    • The MySQL database has a table named user, which contains all user accounts. The user table has a column named users, which stores the username.
    • When using the SELECT * from user\g to obtain the complete table data
      • Where the suffix is priv is the meaning of the permission, n means no.
      • Host is on behalf of allowed logins,% to allow local and non-local hosts to log on
      • User is the username
      • Authentication string is the hash value of the password.

To create a user account:

    • Mode 1:create user username @ Login address identified by ' password ';
      • No sign-in address can be logged in for all addresses
      • If only local logins are allowed, it should be set to localhost
    • Mode 2:grant permissions on the database. Data table to username @ Login address identified by ' password ';
    • Mode 3: You can insert data directly into the user table using INSERT, but it is not recommended.

To modify an account:

    • Rename User: Rename user name @ Login address to new username @ login address; "The login address of the original username is required, and the login address of the new user name is optional, but if you do not fill it, the default is to allow remote login"
    • Change Password: Set password for ' username ' @ Login address = password (' password '); "To modify the password for the current user without specifying a user name" "The login address is optional and must be the original login address"
    • Modifying account permissions will be described in a separate blog post. Hyperlinks: MySQL User Rights Management
To delete an account:

    • Drop user username;

Add:
    • Before mysql5.0, the drop user command only deletes users without deleting permissions, and requires revoke to remove them before 5.0.

About Anonymous users:

    • There will be an anonymous user in the old version by default, which allows you to log in to MySQL without using a user and password
    • How to create an anonymous user
    • In general, anonymous users should not be created, even if they are created for learning convenience and should be cost-effective.

MySQL User management

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.