Get the App
SLTechnology News&Howtos  ›  Database  › 

Set the detailed process sharing for Mysql5.6 to allow public network access

Shulou Source: shulou.com Published: 2022-06-01 03:01:53 10月25日 Update

When mysql5.6 is recently deployed, it is found that the default mysql only allows local services to be provided. If you want to make several configurations, record as follows.

1. Set the MySQL service to allow access to the public network

Modify the configuration files of mysql, either my.ini (windows) or my.cnf (linux)

Add to the configuration file

[mysqld] port=3306bind-address=0.0.0.0

Then restart the mysql service and execute service mysql restart.

2. Set mysql users to support public network access

You need to log in to mysql with root permission, update the mysql.user table, and set the Host field for the specified user to%. The default is 127.0.0.1 or localhost.

1. Log into the database

Mysql-u root-p

Enter password

Mysql > use mysql

two。 Query host

Mysql > select user,host from user

3. Create host

If there is no host value of "%", execute the following two sentences:

Mysql > update user set host='%' where user='root';mysql > flush privileges

4. Authorized user

(1) any host connects to the mysql server with user root and password mypwd

Mysql > GRANT ALL PRIVILEGES ON *. * TO 'root'@'%' IDENTIFIED BY' mypwd' WITH GRANT OPTION;mysql > flush privileges

(2) the host with IP 192.168.133.128 connects to the mysql server with user myuser and password mypwd

Mysql > GRANT ALL PRIVILEGES ON *. * TO 'myuser'@'192.168.133.128' IDENTIFIED BY' mypwd' WITH GRANT OPTION; mysql > flush privileges

[host field description]

Allow login from any ip x.x.x.x allow access from the specified ip

The detailed flow sharing of setting up Mysql5.6 to allow public network access is all the content shared by the editor to you. I hope I can give you a reference and support it.

Tags: Users services passwords logins configurations there are hosts fields files servers support processes content that is data databases permissions x.x.x.x references updates Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Xiaomi macOS Linux MariaDB