Linux under the new Mysql account and permissions settings method _mysql

Source: Internet
Author: User
1, the right to give

Description: MySQL deployed on server A, internal network Host B through the client tools to connect server A for database operations, requires server A to give Host B operation MySQL permissions

1.1 Enter MySQL on Server A, assuming that the MySQL account on server A is root:
Copy Code code as follows:

Mysql-u root-p

Then enter the password!

1.2 Grant Host B the ability to operate the database
Copy Code code as follows:

Mysql> grant usage on *.* to username@192.168.0.1 identified by ' password ';

Description: Give username@192.168.0.1 the right to use all databases, login on host 192.168.0.1 using username account, password: password
Copy Code code as follows:

Mysql> grant all privileges in newdb.* to username@192.168.0.1;

Description: Give username@192.168.0.1 operation database newdb the highest authority, on the host 192.168.0.1 use username account login, no password

Example:
Copy Code code as follows:

Mysql> grant all privileges in *.* to root@192.168.0.1 identified by ' 123456 ';

Description: Give root@192.168.0.1 the right to use all databases, login with root account on host 192.168.0.1, password: 123456

2. Remove account number
Copy Code code as follows:

mysql> drop user root@192.168.0.1;

Note: Remove account root so that the host 192.168.0.1 can no longer use the database on Server A with the root user operation
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.