Get the App
SLTechnology News&Howtos  ›  Database  › 

How to solve the problem that you can't connect to mysql remotely

Shulou Source: shulou.com Published: 2022-06-01 02:39:48 10月05日 Update

This article is about how to solve the problem of not being able to connect to mysql remotely. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

The solution to being unable to connect to mysql remotely is as follows: 1. Log in to mysql;2, execute the command [grant all on database name. * to 'database account name' @'% 'identified by' password 'with grant option;]; 3. Refresh permissions.

Question:

The following prompt appears when connecting to the mysql database remotely:

"MYSQL CONNECT ERROR-1130:Host '202.43.room.cake' is not allowed to connect to this MySQL server"

When creating a mysql account, restrict remote login to the connected account. That is, except for the current mysql installation server, no ip (host) is allowed to access, even if your user name and password are correct. At this point, it is necessary to modify the user's access rights.

Solution:

First, log in to the mysql installation host with the root user, and then enter mysql:

Mysql-u root-p

Root is the highest authorized user name of mysql. At this time, you will be prompted to enter your password. Enter the password correctly and enter mysql. Enter

Then enter the following command:

Grant all on database name. * to 'database account name' @'% 'identified by' password 'with grant option

Enter

Flush privileges

Enter

Note: the above single quotation marks can not be saved, the database name. * indicates all the tables under the database to be open, if all the connected databases are to be open, you can use *. * instead.

The 'database account name' @'% 'indicates the account to be opened, and the percent sign indicates that access is allowed on any host.

If the above two steps show "Query OK, 0 rows affected (0.00 sec)", then the command has been executed successfully and you can now connect to your mysql database remotely.

Thank you for reading! On how to solve the problem of not being able to connect to mysql remotely, I hope the above content can help you to some extent, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.

Tags: Data database account password user question host command open login input content method more permissions user name prompt good practical highest Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Shulou Tech Info macOS Docker Huawei