Get the App
SLTechnology News&Howtos  ›  Database  › 

A brief Analysis of solving the mysql problem of client connection

Shulou Source: shulou.com Published: 2022-06-01 20:11:50 09月20日 Update

This article mainly gives you a brief introduction to solving the mysql problem of client connection. You can check the relevant professional terms on the Internet or find some related books to supplement them. We will not dabble here. Let's go straight to the topic of solving the problem of client connection mysql. I hope it can bring you some practical help.

This error occurs when you try to connect to your mysql:

ERROR 1130: Host '192.168.16.145' is not allowed to connect to this MySQL server

Change the meter.

It may be that your account is not allowed to log in remotely, only in localhost. At this time, as long as on the computer in localhost, after logging in to mysql, change the "host" entry in the "user" table in the "mysql" database from "localhost" to "%"

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

two。 Authorization law.

(1) for example, if you want myuser to connect to the mysql CVM from any host using mypassword

GRANT ALL PRIVILEGES ON *. * TO 'myuser'@'%' IDENTIFIED BY' mypassword' WITH GRANT OPTION

(2) if you want to allow the user myuser to connect to the mysql server from the host with ip 192.168.16.145, and use mypassword as the password

GRANT ALL PRIVILEGES ON *. * TO 'root'@'192.168.16.145' IDENTIFIED BY' mypassword' WITH GRANT OPTION

(3) the last sentence must be added!

Mysql > flush privileges

The following error occurred:

Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. Java.net.ConnectException: Connection refused: connect

At this point, you need to log in to the server and set up your mysql and restart mysql as follows

Vim / etc/mysql/my.cnf

Bind-address = 127.0.0.1 in the configuration

Change this item to bind-address = 0.0.0.0

Unbind MySQL Server to the local address!

Save exit after (wq)

Sudo / etc/init.d/mysql restart (restart the mysql service) or sudo service mysql restart

To solve the mysql problem of client connection, let's stop here. If you want to know about other related issues, you can continue to pay attention to our industry information. Our section will capture some industry news and professional knowledge to share with you every day.

Tags: Questions services clients clients servers specialties hosts times industries errors expertise topics books content addresses actual passwords data databases news Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Linux NVidia Shulou Tech Info Apple