Home  >  Article  >  Database  >  What should I do if navicat displays 1251 error when connecting to mysql?

What should I do if navicat displays 1251 error when connecting to mysql?

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-08-05 12:00:223896browse

What should I do if navicat displays 1251 error when connecting to mysql?

I reinstalled the computer and installed the latest version of the MySQL database. As a result, Navicat reported a 1251 error when connecting to Mysql, and SQL reported a 2058 error. However, the window command entered mysql, and the account and password were correct. of.

What should I do if navicat displays 1251 error when connecting to mysql?

Related recommendations: "Navicat for mysql graphic tutorial"

I checked online that the reason for this is mysql8 In previous versions, the encryption rule was mysql_native_password, but after mysql8, the encryption rule was caching_sha2_password.

There are two ways to solve the problem. One is to upgrade the navicat driver; the other is to restore the mysql user login password encryption rule to mysql_native_password.

I usually use the second method:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; #修改加密规则
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #更新一下用户的密码
FLUSH PRIVILEGES; #刷新权限

I see many people copying directly with the command, which is wrong.

·'root' is the user name you defined

·'localhost' refers to It is the IP opened by the user. It can be 'localhost' (local access only, equivalent to 127.0.0.1), it can be a specific '*.*.*.*' (a specific IP), or it can be '%' (All IPs are accessible)

·'password' is the user password you want to use

In this way, the problem is solved.

The above is the detailed content of What should I do if navicat displays 1251 error when connecting to mysql?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn