Set up mysql in linux to support external network access

1. Find my.cnf (linux), the file directory

 

whereis my.cnf

2. Edit the my.cnf file and add the following two sentences

 

port=3306

bind-address=0.0.0.0

 

3.进入数据库

 

Use the command use mysql

Execute SQL to modify fields

update user set host ='%' where user ='root';

before fixing

After modification

 

Save

flush privileges;

4. Execute command ip filtering

 

Where mypwd is the password used for the test, please replace it according to your own configuration

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mypwd' WITH GRANT OPTION;

Execute save

flush privileges;

 

At this time, the Internet can be accessed

Published 115 original articles · Like 58 · Visits 160,000+

Guess you like

Origin blog.csdn.net/luChenH/article/details/104377483