Perfect solution to the problem of connection failure after MySQL client authorization

Perfect solution to the problem of connection failure after MySQL client authorization

Deploy the MySQL environment locally (192.168.1.152), authorize the remote client 192.168.1.% to connect to the local MySQL, and open port 3306 in the iptables firewall.

as follows:

mysql> select host,user,password from mysql.user;
+--------------+-----------------+---------------------------------------------------------+
| host | user | password |
+--------------+-----------------+----------------------------------------------------------+
| localhost | root | |
| fdm1 | root | |
| 127.0.0.1 | root | |
| localhost | | |
| fdm1 | | |
| 192.168.1.% | db_hqsb | *DFC9DC16B13651A95ECEC3A26E07D244431B55C9 |
| 192.168.1.% | db_ro_hqsb | *2C0B0DD50595BB40879110437BEEF026D019DFB7 |
| 192.168.1.% | db_jkhwuser | *2C0B0DD50595BB40879110437BEEF026D019DFB7 |
| 192.168.1.25| slave | *EE52B8EACB3CCD13624273AD6B5CDA52B9B53EB7 |
| 192.168.1.% | tech_db_user | *6053E57C7B61043DC2C6B4E3291D5F61CCC23F5C |
| 192.168.1.% | game_db_user| *05EA4D71C9A1273ECF3E24E6323F7175AE45C366 |
| localhost | zabbix | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
+---------------+---------------+------------------------------------------------------------+

question:

Remotely connect to mysql on the 192.168.1.152 machine above on the client (for example, 192.168.1.20), the connection fails!

[root@huanqiu ~]# mysql -udb_ro_hqsb -h 192.168.1.152 -pmhxzkhl0802xqsjdb
ERROR 1130 (HY000): Host '192.168.1.20' is not allowed to connect to this MySQL server

solve:

This is caused by the statement "host is localhost, user and password are empty" in the mysql of 192.168.1.152. Deleting this statement can solve the problem!

mysql> delete from mysql.user where host="localhost" and user="";
Query OK, 1 row affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

In this way, the client computer authorized to connect can successfully connect!

[root@huanqiu ~]# mysql -uxqsj_db_ro_user -h 192.168.1.152 -pmhxzkhl0802xqsjdb
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 28
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

The above article perfectly solves the problem of connection failure after MySQL client authorization. This is all the content that the editor shares with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • Solve the problem of MySql client exiting in seconds (my.ini not found)
  • PHP Swoole asynchronous MySQL client implementation example
  • Solve the problem that the Node.js mysql client does not support the authentication protocol
  • Solution to the problem that the mysql8.0.11 client cannot log in
  • MySql uses skip-name-resolve to solve the problem of slow external network connection client
  • How to solve the problem of garbled Chinese characters displayed in the MySQL client output window
  • Compiling MySQL client using Cygwin under Windows
  • ThinkPHP combines ajax and Mysql to implement client communication function code example
  • 2 ways to connect to the database directly without entering a username and password
  • How does MySQL connect to the corresponding client process?

<<:  Native JavaScript to achieve skinning

>>:  VMware vSphere 6.7 (ESXI 6.7) graphic installation steps

Recommend

JavaScript type detection method example tutorial

Preface JavaScript is one of the widely used lang...

Use nginx to dynamically convert image sizes to generate thumbnails

The Nginx ngx_http_image_filter_module module (ng...

...

Detailed process of decompressing and installing mysql5.7.17 zip

1. Download address https://dev.mysql.com/downloa...

Installation tutorial of mysql8.0rpm on centos7

First, download the diagram 1. First uninstall th...

Detailed explanation of JavaScript's Set data structure

Table of contents 1. What is Set 2. Set Construct...

In-depth study of vue2.x--Explanation of the h function

Table of contents Solution, Summarize: vue projec...

Solve the problem of forgetting password in MySQL 5.7 under Linux

1. Problem Forgot password for mysql5.7 under lin...

HTML page jump and parameter transfer issues

HTML page jump: window.open(url, "", &q...

Docker uses Supervisor to manage process operations

A Docker container starts a single process when i...

jQuery implements percentage scoring progress bar

This article shares the specific code of jquery t...

Implementation of code optimization for Vue2.x project performance optimization

Table of contents 1 Use of v-if and v-show 2. Dif...

Sample code of uniapp vue and nvue carousel components

The vue part is as follows: <template> <...

How to modify the IP restriction conditions of MySQL account

Preface Recently, I encountered a requirement at ...