MySQL beginner's notes ① and mysql beginner's notes

Source: Internet
Author: User
Tags mysql login

MySQL beginner's notes ① and mysql beginner's notes

1. MySQL Login

MySQL-u username-p

2. Create a user in MySQL

Use mysql // enter the mysql table

Insert into user (Host, User, Password) VALUES ('%', 'username', PASSWORD ('Password ')); // % indicates that any IP address can be accessed. You can directly enter IP address control to log on to localhost, indicating smart local login.

3. user permission management

1) Set permissions

Grant all on db_name.tb_name to 'username' @ 'host'; // all indicates all the permissions in the current database. select indicates the query permission, update delete, and other permissions (separated by commas) db_name indicates the name of the table to be authorized, and tb_name indicates the name of the table in the database * indicates all

2) delete permissions

Revoke all on db_name.tb_name to 'username' @ 'host'; // if you do not have the permission to delete the file, an error is returned.

3) directly delete a user

Delete from mysql. user WHERE User = 'username' and Host = '% ';

Note:

After setting a user and granting the user permission, remember to refresh the permission and flush privileges;

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.