博客
关于我
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安装crypto-js 如何安装crypto-js, python爬虫安装加解密插件 找不到模块crypto-js python报错解决丢失crypto-js模块
    查看>>
    npm报错Failed at the node-sass@4.14.1 postinstall script
    查看>>
    npm报错unable to access ‘https://github.com/sohee-lee7/Squire.git/‘
    查看>>
    npm的常用配置项---npm工作笔记004
    查看>>
    npm的问题:config global `--global`, `--local` are deprecated. Use `--location=global` instead 的解决办法
    查看>>
    npm编译报错You may need an additional loader to handle the result of these loaders
    查看>>
    npm配置安装最新淘宝镜像,旧镜像会errror
    查看>>
    npm错误 gyp错误 vs版本不对 msvs_version不兼容
    查看>>
    npm错误Error: Cannot find module ‘postcss-loader‘
    查看>>
    NPOI之Excel——合并单元格、设置样式、输入公式
    查看>>
    NPOI利用多任务模式分批写入多个Excel
    查看>>
    NPOI在Excel中插入图片
    查看>>
    NPOI格式设置
    查看>>
    Npp删除选中行的Macro录制方式
    查看>>
    NR,NF,FNR
    查看>>
    nrf开发笔记一开发软件
    查看>>
    nrm —— 快速切换 NPM 源 (附带测速功能)
    查看>>
    NS3 IP首部校验和
    查看>>
    NSDateFormatter的替代方法
    查看>>
    NSError 的使用方法
    查看>>