博客
关于我
python3 mysql8_Python MySQL8.0 错误:authentication plugin 'calling_sha2_password' is not supported....
阅读量:798 次
发布时间: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/

    你可能感兴趣的文章
    Python关键代码总览!从Zero到Hero必看的考点
    查看>>
    python3 robotframework+pycharm框架搭建
    查看>>
    Python3 shutil模块
    查看>>
    Python关于strftime函数详细解析 附实战代码
    查看>>
    Python3 tutorial day3
    查看>>
    python3 week4
    查看>>
    Python3 创建数组
    查看>>
    python3 套接字异常(a byte-like object is required not str)
    查看>>
    python3 实现用户三次输入错误记录黑名单并对该用户登录锁定-day1
    查看>>
    python3 文本变图片
    查看>>
    Python3 查看 com 组件的属性
    查看>>
    python3 案例分享--发邮件
    查看>>
    python3 模板库_Python3 标准库概览_Python教程_我爱模板网 - 提供下载各种免费建站资源,免费网站模板,免费网页特效,让你爱上建站!...
    查看>>
    Python3 求最大/小值及索引值 Numpy
    查看>>
    python3+django使用celery执行某些任务失败的解决方案
    查看>>
    Python3+Requests+Unittest实战系列【一】
    查看>>
    python3+requests+unittest实战系列【一】
    查看>>
    python3+requests+unittest实战系列【二】
    查看>>
    Python3+Requests+Unittest实战系列【二】
    查看>>
    python3----ASCII
    查看>>