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

Demystifying the HTML 5 Working Draft

The World Wide Web Consortium (W3C) has released a...

Example of how to mosaic an image using js

This article mainly introduces an example of how ...

Comparing the performance of int, char, and varchar in MySQL

There are many seemingly true "rumors" ...

Using an image as a label, the for attribute does not work in IE

For example: Copy code The code is as follows: <...

Refs and Ref Details in Vue3

The editor also shares with you the corresponding...

MySQL Optimization Solution Reference

Problems that may arise from optimization Optimiz...

How to implement parallel downloading of large files in JavaScript

Table of contents 1. HTTP Range Request 1.1 Range...

...

Detailed explanation of JavaScript progress management

Table of contents Preface question principle test...

Docker container orchestration implementation process analysis

In actual development or production environments,...

Javascript Virtual DOM Detailed Explanation

Table of contents What is virtual dom? Why do we ...

Vue implements an Input component that gets the key display shortcut key effect

I encountered a requirement to customize shortcut...

How to create Baidu dead link file

There are two types of dead link formats defined b...