Get the App
SLTechnology News&Howtos  ›  Database  › 

How to allow public network access in mysql

Shulou Source: shulou.com Published: 2022-05-31 22:12:06 09月22日 Update

How to allow public network access in mysql? In view of this problem, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.

1. Modify the table, log in to the mysql database, switch to the mysql database, and use the SQL statement to view "select host,user from user;"

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

Note: the last sentence is important in order to make the changes effective. If you don't write, you still can't make a remote connection.

2, authorized user, you want root to connect to the mysql server from any host with a password

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

If you want to allow the user root to connect to the mysql server from the host with an ip of 192.168.1.104

GRANT ALL PRIVILEGES ON *. * TO 'myuser'@'192.168.1.104' IDENTIFIED BY' admin123' WITH GRANT OPTION;flush privileges

Modify MySql password

The password field in MySQL 5.7 has been removed from the mysql.user table with the new field name "authenticalion_string".

Select the database:

Use mysql

Update the password for root:

Update user set authentication_string=password ('new password') where user='root' and Host='localhost'

Refresh permissions:

This is the answer to flush privileges; 's question on how to allow public network access in mysql. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

Tags: Password data database question fair host field more server user help service answer easy important easy content buddy partner method Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker MariaDB Shulou Information OPPO Reno Huawei