MySQL, add and remove users, add permissions

Source: Internet
Author: User

    • Create user
Mysql>INSERT INTO Mysql.user (Host,user,password) VALUES ("localhost" ," Test ", Password (" 1234 "));added a username for test, password for 1234 users. However, the user can only log in locally, if you want to log on remotely, you can change the localhost to% to indicate that no matter what a computer can log on. Or a specific IP indicates that only a specific IP address can be logged on.
    • To add permissions to a user
     mysql>grant all privileges in testdb.* to [e-mail protected] identified by ' 1234 ';Indicates to the user that the test has added a local login to all tables of the TestDB database regardless of the operation. If you want to specify permissions. You can add allPrivileges modified to a combination of select or update or delete or three. If you want to specify the permissions of the table, you can change the testdb.* to Testdb.info to indicate that the info table in the TestDB database can be manipulated; If you want to specify an access address, you can change the @% to localhost to indicate that the user test can only perform local operations on the database.

    • Refresh System Permissions Table
Mysql>flush privileges;
    • Delete User
     mysql>delete from user Where user= ' test ' and host= ' localhost ';
    • Delete accounts and permissions
MySQL>drop User [email protected] '% ';
    • change user Password
     mysql>update Mysql.user Set Password=password (' New password ') where user= "test" and host= "localhost";

Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.

MySQL, add and remove users, add permissions

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.