MySQL Beginner note ①--MySQL user login rights control

Source: Internet
Author: User
Tags mysql create mysql create user mysql login

1. MySQL Login

Mysql-u username-p

2. MySQL Create user

Use MySQL//enter MySQL table

INSERT into User (Host,user,password) VALUES ('% ', ' username ', Password (' Passwword ')); % indicates that any IP can be accessed directly by entering IP control login localhost for smart native login

3. User Rights Management

1) Set permissions

Grant all on Db_name.tb_name to ' username ' @ ' host '; All indicates that all permissions in the current database select represents the permissions of the query permission update Delete (multiple, separated by numbers) db_name refers to the name of the table to which the permission is granted, tb_name refers to the table name in the database * refers to all

2) Delete permissions

Revoke all on db_name.tb_name to ' username ' @ ' host '; If you do not have permission to delete an error

3) Delete user directly

DELETE from Mysql.user WHERE user= ' username ' and host= '% ';

Precautions:

Set the user, and give the user permissions to remember to refresh the permissions, flush privileges;

MySQL Beginner note ①--MySQL user login rights control

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.