当前位置:网站首页>MySQL other hosts cannot connect to the local database

MySQL other hosts cannot connect to the local database

2022-07-06 10:54:00 hyh123a

Preface

mysql  Cannot pass local  ip, Such as : This machine IP by 172.16.16.16 
172.16.16.16  The connection fails , Only through 127.0.0.1 Connect .

                                        ---  Record on 2021 year 8 month 

Environmental Science

Ubuntu 20.04
mysql  Ver 8.0.26-0ubuntu0.20.04.2 for Linux on x86_64 ((Ubuntu))
 Other hosts can Ping Through this machine 

solve

To solve this problem, we can try the following two points

1、 Change user name jurisdiction

localhost -> % #  This is mentioned in most blogs   But say more 

2、 modify MySQL The configuration file

2.1 Check the location of the configuration file

cd /etc/mysql
ls

2.2 Modify the configuration file

sudo nano /etc/mysql/my.cnf #  One of the two   See which configuration file is on your host 
sudo nano /etc/mysql/mysql.conf.d #  One of the two   See which configuration file is on your host 

#  modify  127.0.0.1 => 0.0.0.0

2.3 restart mysql service

sudo systemctl restart mysql.service 
sudo systemctl status mysql.service 
#  Test connection successful 

other

If there is any omission, please add
If you have any questions, please leave a message
If it works, please like it
2021 year 8 Monthly test installation succeeded

原网站

版权声明
本文为[hyh123a]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207060912154874.html