MySQL Add, 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 user name of test, password for 1234 users, but the user can only log on locally, if you want to remotely log in, you can change localhost to% to indicate that any computer can log on, or to a specific IP address can only be landed on a specific IP.
    • Add permissions for a user
     mysql>grant all privileges in testdb.* to [e-mail protected] identified by ' 1234 ';represents the addition of any operation to all tables of the TestDB database to user test when logging on locally. If you want to specify permissions, you can modify all privileges to select or update or delete or the combination of the three, if you want to specify the permissions of the table, you can testdb.* Modifying to Testdb.info means that the info table in the TestDB database can be manipulated; If you want to specify the address of the access, 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 username @ '% ';
    • Modify User Password
     mysql>update Mysql.user Set Password=password (' New password ') where user= "test" and host= "localhost";

MySQL Add, 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.