Navicat 和python访问mysql数据库

版权声明:著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。 https://blog.csdn.net/ChaoFeiLi/article/details/88607494

第一个问题:Navicat 链接mysql

若出现如下错误:

Clinet dose not support authentication protocol request by server ;consider upgrading MySQL client

解决方式:

1、通过管理员权限进入cmd,mysql -u root -p
2、更改加密方式

 ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;

3、更改密码

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '111';

这个密码是navicat链接mysql 的密码

4、FLUSH PRIVILEGES;

第二个问题:通过python访问数据库

出现如下错误:

pymysql.err.InternalError: (1130, "Host '***-PC' is not allowed to connect to this MySQL server")  T

解决方式:

 mysql -u root -p
 use mysql;#进入数据库
 update user set Host='%' where User='root';
 flush privileges;

猜你喜欢

转载自blog.csdn.net/ChaoFeiLi/article/details/88607494