How to create an account and Set permissions for mysql in Linux

Source: Internet
Author: User

1. Grant Permissions

Description: mysql is deployed on server A. Host B on the Intranet connects to server A through client tools for database operations. Server A needs to grant host B the permission to operate mysql.

1.1 log on to mysql on server A. Assume that the mysql account on server A is root:Copy codeThe Code is as follows: mysql-u root-p

Then press enter to enter the password!

1.2 grant database operation permissions to host BCopy codeThe Code is as follows: mysql> grant usage on *. * to username@192.168.0.1 identified by 'Password ';

(Grant username@192.168.0.1 to use all the database permissions, on the host 192.168.0.1 using username Account Login, password: password)Copy codeThe Code is as follows: mysql> grant all privileges on newdb. * to username@192.168.0.1;

(Grant username@192.168.0.1 operation database newdb the highest permissions, on the host 192.168.0.1 using username Account Login, no password)

Example:Copy codeThe Code is as follows: mysql> grant all privileges on *. * to root@192.168.0.1 identified by '123 ';

(Grant root@192.168.0.1 to use all the database permissions, on the host 192.168.0.1 use root Account Login, password: 123456)

2. Remove an accountCopy codeThe Code is as follows: mysql> drop user root@192.168.0.1;

Remove the root account. In this way, the host 192.168.0.1 can no longer use the root user to operate the database on server.

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.