Navicat connect to mysql error is not allowed to connect to this MySQL

When Navicat connects to mysql, an error is reported is not allowed to connect to this MySQL
Insert picture description here
1. Change the table method.

It may be that your account does not allow remote login, only localhost. At this time, as long as you are on the localhost computer, after logging in to MySQL, change the "host" item in the "user" table in the "mysql" database, and change the name from "localhost" to "%"

mysql -u root -p

mysql>use mysql;

mysql>update user set host = '%' where user = 'root';

mysql>select host, user from user;

Note: Personally feel that it is not suitable!

【错误内容】:SQL Error (2013): Lost connection to MySQL server at ‘waiting for initial communication packet’, system error: 0

[Error generation process]: Appears when connecting to MySQL.

[Solution]: Open my.ini, find the [mysqld] item, add a sentence after it: skip-name-resolve, save, and restart the mysql service~

2. Authorization law.

1) For example, if you want myuser to use mypassword to connect to the mysql server from any host.

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

FLUSH   PRIVILEGES;

2) If you want to allow the user myuser to connect to the mysql server from the host whose ip is 192.168.1.6, and use mypassword as the password

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

FLUSH   PRIVILEGES;

3) If you want to allow the user myuser to connect to the dk database of the mysql server from the host whose ip is 192.168.1.6, and use mypassword as the password

GRANT ALL PRIVILEGES ON dk.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

FLUSH   PRIVILEGES;

Reference:
Remote connection to MySQL database error: is not allowed to connect to this MYSQL server solution

Guess you like

Origin blog.csdn.net/qq_33697094/article/details/110071273
Recommended