博客
关于我
python3 mysql8_Python MySQL8.0 错误:authentication plugin 'calling_sha2_password' is not supported....
阅读量:795 次
发布时间:2023-03-08

本文共 926 字,大约阅读时间需要 3 分钟。

在安装并配置了MySQL-8.0.16后,运行示例Python程序时遇到了“authentication plugin 'calling_sha2_password' is not supported”错误。以下是解决问题的详细步骤:

  • 创建my.ini文件:在MySQL安装目录下新建my.ini文件,并填写必要的配置。

    [mysqld]port = 3306basedir=D:\web\mysql-8.0.16-winx64max_connections=20character-set-server=utf8default-storage-engine=INNODBdefault_authentication_plugin=mysql_native_password[mysql]default-character-set=utf8[client]port=3306default-character-set=utf8
  • 启动MySQL并登录:启动MySQL服务并使用root用户登录。

  • 检查默认插件:执行SQL命令查看当前用户的插件状态。

    use mysql;select plugin, authentication_string from user;
  • 更换插件:如果插件已更换为caching_sha2_password,需将其恢复为mysql_native_password,并更新密码加密方式。

  • 修改密码:使用SQL命令将root用户的密码更换为sha1模式。

    ALTER USER 'root'@'127.0.0.1' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;ALTER USER 'root'@'127.0.0.1' IDENTIFIED WITH mysql_native_password BY 'password';FLUSH PRIVILEGES;
  • 重启MySQL:执行shutdown命令并重新启动MySQL服务。

  • 测试连接:运行Python程序,确保能够正常连接到MySQL数据库。

  • 通过以上步骤,问题得以解决,确保了与MySQL 8.0兼容并保持了原有的认证方式。

    转载地址:http://julfk.baihongyu.com/

    你可能感兴趣的文章
    npm ERR! fatal: unable to connect to github.com:
    查看>>
    npm ERR! Unexpected end of JSON input while parsing near ‘...“:“^1.2.0“,“vue-html-‘ npm ERR! A comp
    查看>>
    npm error Missing script: “server“npm errornpm error Did you mean this?npm error npm run serve
    查看>>
    npm error MSB3428: 未能加载 Visual C++ 组件“VCBuild.exe”。要解决此问题,1) 安装
    查看>>
    npm install CERT_HAS_EXPIRED解决方法
    查看>>
    npm install digital envelope routines::unsupported解决方法
    查看>>
    npm install 卡着不动的解决方法
    查看>>
    npm install 报错 EEXIST File exists 的解决方法
    查看>>
    npm install 报错 ERR_SOCKET_TIMEOUT 的解决方法
    查看>>
    npm install 报错 Failed to connect to github.com port 443 的解决方法
    查看>>
    npm install 报错 fatal: unable to connect to github.com 的解决方法
    查看>>
    npm install 报错 no such file or directory 的解决方法
    查看>>
    npm install 权限问题
    查看>>
    npm install报错,证书验证失败unable to get local issuer certificate
    查看>>
    npm install无法生成node_modules的解决方法
    查看>>
    npm install的--save和--save-dev使用说明
    查看>>
    npm node pm2相关问题
    查看>>
    npm run build 失败Compiler server unexpectedly exited with code: null and signal: SIGBUS
    查看>>
    npm run build报Cannot find module错误的解决方法
    查看>>
    npm run build部署到云服务器中的Nginx(图文配置)
    查看>>