How to configure whitelist access in mysql

How to configure whitelist access in mysql

Steps to configure whitelist access in mysql

1. Log in

mysql -uroot -pmysql

2. Switch to mysql database

use mysql;

3. View users with whitelist permissions

select Host,User from user;

4. Specify the IP address that has permission to access MySQL

GRANT ALL ON *.* to root@'192.168.1.4' IDENTIFIED BY 'your-root-password';

If you don't have a password, leave it blank.

GRANT ALL ON *.* to root@'192.168.1.4' ;

The ip behind @ is the specified whitelist ip

5. Delete the permissions of whitelisted users

DELETE FROM user WHERE User='username' and Host='host';

6. Refresh

After modifying permissions, you need to refresh them to take effect

FLUSH PRIVILEGES;

mysql ip whitelist using wildcard

Today, I want to let MySQL add IP addresses like 192.168.*.* to the whitelist.

When I use 192.168.%.%, mysql reports an error

Error: 192.168.%.% is not a valid remote host

If you use a fixed IP such as 192.168.0.1, no error will be reported.

After some research, I found that the correct way to write it should be to add the subnet mask 192.168.0.0/255.255.0.0, so that access from the entire Class B subnet is allowed.

The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed explanation of MYSQL configuration parameter optimization
  • 10 Configurations You Must Adjust for MySQL Optimization
  • MySql installation and configuration method (MySQL add users, delete users and authorization)

<<:  Nginx configuration to achieve multiple server load balancing

>>:  Dealing with the problem of notes details turning gray on web pages

Recommend

Advertising skills in the Baidu Union environment (graphic tutorial)

Recently, students from the User Experience Team o...

11 ways to remove duplicates from js arrays

In actual work or interviews, we often encounter ...

SQL merge operation of query results of tables with different columns

To query two different tables, you need to merge ...

Ubuntu 20.04 how to modify the IP address example

illustrate: Today, when continuing the last offic...

In-depth analysis of the Linux kernel macro container_of

1. As mentioned above I saw this macro when I was...

mysql 5.7.19 latest binary installation

First download the zip archive version from the o...

MySQL multi-table query detailed explanation

Eating well and getting enough rest sounds simple...

Detailed explanation of Tomcat configuration and optimization solutions

Service.xml The Server.xml configuration file is ...

Detailed explanation of html-webpack-plugin usage

Recently, I used html-webapck-plugin plug-in for ...

10 bad habits to avoid in Docker container applications

There is no doubt that containers have become an ...