MySQL database remote access permission setting method summary _ MySQL

Source: Internet
Author: User
Summary of how to set remote access permissions for MySQL database: bitsCN. the first part of the basic knowledge of comMySQL is the summary of how to set permissions for remote access to MySQL databases. it discusses how to access a single database, all databases, specify user access, set access passwords, and specify access hosts.

1. set the permissions to access a single database


Mysql> grant all privileges on test. * to 'root' @ '% ';

Note: the user name is set to root, and the password is blank. you can access the database test.

2. set all database access permissions


Mysql> grant all privileges on *. * to 'root' @ '% ';

Note: Set the username to root and the password to null to allow access to all databases *

3. set the access permission for the specified user name


Mysql> grant all privileges on *. * to 'liuhui' @ '% ';

Note: Set the specified user name to liuhui and the password to be blank to allow access to all databases *

4. set password access permissions


Mysql> grant all privileges on *. * to 'liuhui' @ '%' identified by 'liuhui ';

Note: Set the specified user name to liuhui and the password to liuhui to access all databases *

5. set the specified accessible host permissions.


Mysql> grant all privileges on *. * to 'liuhui' @ '10. 2.1.11 ';

Note: Set the specified user name to liuhui to access all databases. * only the machine 10.2.1.11 has the permission to access the database.

You can also set to access a data table in a database. follow the MySQL Basics series.

BitsCN.com

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.