MySQL security management and mysql Management

Source: Internet
Author: User

MySQL security management and mysql Management

How to enter mysql under Dos

1. Go to the mysql installation directory

cd C:\Program Files\MySQL\MySQL Server 5.6\bin

2. User Login

mysql -hlochlhost -uabc -pabc

-H: indicates the server name. The lochlhost is the local machine.

-U: User Name

-P: password. If the user does not have a password, simply-p.

 

Create user

CREATE USER  li@localhost IDENTIFIED BY 'li';

Grant all permissions of the user li database person and allow the user li to grant all permissions of the database person to other users

GRANT ALL ON PERSON.* TO li@localhost WITH GRANT OPTION;

Take effect immediately. If the granted permissions do not take effect, the following command will take effect after version 5.6 change.

FLUSH PRIVILEGES;

GRANT create user

If no user exists, GRANT can create a user when granting permissions.

Grant select and insert permissions to all tables of the user database person.

Grant select, insert on person. * TO 'abc' @ 'localhost' identified by 'abc ';

At the same time, run user abc to grant the SELECT and INSERT permissions of the person database to other users.
GRANT SELECT,INSERT ON PERSON.* TO 'abc'@'localhost' identified by 'abc' with grant option;

Exit current user

exit

View permissions of the current user

show grants;

View User abc Permissions

show grants for abc@localhost;


REVOKE permissions from REVOKE

Revoke the insert permission of user abc database person

REVOKE INSERT ON PERSON.* FROM abc@localhost;

Revoke permissions

Revoke all permissions of the person database abc revoke all on person. * FROM abc @ localhost; revoke all permissions of ALL databases of abc revoke all on *. * FROM abc @ localhost;

Delete a user

In earlier versions, users must be revoked before they can be deleted.

DROP USER abc@localhost;

 

 

Note:

Author: pursuer. chen

Blog: http://www.cnblogs.com/chenmh

All essays on this site are original. You are welcome to repost them. However, you must indicate the source of the article and clearly provide the link at the beginning of the article. Otherwise, you will be held accountable.

Welcome to discussion

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.