Home  >  Article  >  Database  >  What should I do if a 1251 error occurs when Navicat connects to Mysql8.0.11?

What should I do if a 1251 error occurs when Navicat connects to Mysql8.0.11?

醉折花枝作酒筹
醉折花枝作酒筹forward
2021-05-24 10:03:362248browse

This article will introduce to you how to solve the 1251 error when Navicat connects to Mysql8.0.11. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

What should I do if a 1251 error occurs when Navicat connects to Mysql8.0.11?

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 sqlyog reported a 2058 error. However, the window command entered mysql, and the account and password were both is correct.

I checked online that the reason for this is that the encryption rule in versions before mysql8 is mysql_native_password, but after mysql8, the encryption rule is caching_sha2_password. There are two ways to solve the problem. One is to upgrade the navicat driver, and the other is to restore the mysql user login password encryption rule to mysql_native_password.

I often 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 think many people use it It is wrong to copy the command directly.

'root' Define the user name for yourself

'localhost' refers to the IP open to the user, which can be 'localhost' (only local access, equivalent to 127.0 .0.1), it can be a specific '*.*.*.*' (a specific IP), or it can be '%' (all IPs can be accessed)

'password' is what you want to use User password

Recommended learning: php video tutorial

The above is the detailed content of What should I do if a 1251 error occurs when Navicat connects to Mysql8.0.11?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete