Modify the permission Method for mysql to allow access to the host. mysql allows access to the host.

Source: Internet
Author: User

Modify the permission Method for mysql to allow access to the host. mysql allows access to the host.

Enable mysql Remote Access Permissions

By default, mysql users do not have the permission for remote access. Therefore, when the program is not on the same server as the database, we need to enable the remote access permission for mysql.

There are two mainstream Methods: table modification and authorization.

Relatively speaking, it is easier to change the table method. individuals prefer to use this method. Therefore, only the alter table method is attached here.

1. log on to mysql

Mysql-u root-p

2. Modify the user table of the mysql database and change the host item from localhost to %. % This indicates that access from any host is allowed. If only one ip address is allowed, you can change it to the corresponding ip address. For example, you can change localhost to 192.168.1.123, this means that only the ip address 192.168.1.123 of the LAN can remotely access mysql.

Mysql> use mysql; mysql> update user set host = '%' where user = 'root'; mysql> select host, user from user; mysql> flush privileges;

Open firewall port 3306

Summary

The above section describes how to modify the permission for mysql to allow access to the host. I hope it will help you. If you have any questions, please leave a message and I will reply to you in a timely manner. Thank you very much for your support for the help House website!

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.