Home > Database > Mysql Tutorial > body text

How to modify the resolution of allowed host access permissions in mysql

黄舟
Release: 2017-07-27 15:36:42
Original
1254 people have browsed it

Enable remote access permissions for mysql

By default, mysql users do not have remote access permissions, so when the program and the database are not on the same server, we need to enable remote access permissions for mysql.

There are two mainstream methods, the table modification method and the authorization method.

Relatively speaking, the table modification method is easier, and I personally tend to use this method. Therefore, only the table modification method is posted here.

1. Log in to mysql

mysql -u root -p
Copy after login

2. Modify the user table of the mysql library and change the host item from localhost to %. %This means that any host is allowed to access. If only a certain IP is allowed to access, it can be changed to the corresponding IP. For example, localhost can be changed to 192.168.1.123, which means that only the IP 192.168.1.123 of the LAN is allowed to remotely access mysql. .

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

Firewall opens port 3306

The above is the detailed content of How to modify the resolution of allowed host access permissions in mysql. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template