Modify MySQL permissions to allow host access

Source: Internet
Author: User

Turn on MySQL remote access permission

The default MySQL user does not have remote access permission, so when the program is not on the same server as the database, we need to turn on MySQL remote access.

There are two main ways to change the table method and the authorization law.

Relatively speaking, it is easier to change the table method, the individual is also more inclined to use this method, so, here only to paste the table method

1. Log in to MySQL

Mysql-u root-p

2. Modify the user table of the MySQL library and change the host entry from localhost to%. % here is to allow any host access, if only one IP access, you can change to the corresponding IP, such as can be changed to 192.168.1.123, this means that only allow LAN 192.168.1.123 this IP remote access to MySQL.


mysql> use MySQL;
mysql> Update user Set host = '% ' where user = ' root ';
Mysql> Select Host, user from user;
mysql> flush Privileges;

Firewall Open 3306 Port

Modify MySQL permissions to allow host access

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.