查了下,出现这个错误的原因是从mysql 5.6开始,mysql密码加密算法更改了。

我装的mysql 8.* ,那么有两种解决方法:

  1. mysql 版本选择 <= 5.6
  2. 修改密码
    docker-comopse exec mysql bash
    mysql -uroot -psecret
    alter user `db_user`@'%' identified with mysql_native_password by 'db_password';
    flush privilefes;

      

    解决。

    2018-12-5 update:
    PS:Laravel中的.env设置的是:

    DB_CONNECTION=mysql
    DB_HOST=mysql
    DB_PORT=
    DB_DATABASE=db_name
    DB_USERNAME=db_user
    DB_PASSWORD=db_pwd

    DB_HOST 是docker 中mysql container 名字。
    DB_PORT 是mysql container 内部端口

Docker mysql 连接 “The server requested authentication method unknown to the clien”错误的更多相关文章

  1. Laravel - 解决连接MySQL时报"The server requested authentication method unknown to the client”错误

    2019-04-12发布:hangge阅读:934   1,问题描述 最近建了个 Laravel 项目,当配置好 MySQL 数据库进行请求时,页面报如下错误:   SQLSTATE[HY000] [ ...

  2. mysql 8.0 错误The server requested authentication method unknown to the client

    mysql 安装了最新版本8.0.11后创建用户并授权后,授权的用户连接数据库提示 The server requested authentication method unknown to the ...

  3. php7.3连接MySQL8.0报错 PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]

    报的错误: In Connection.php line : SQLSTATE[HY000] [] The server requested authentication method unknown ...

  4. PHP错误:SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

    使用PHP连接MySQL 8的时候,可能会发生如标题所示的错误: SQLSTATE[HY000] [2054] The server requested authentication method u ...

  5. mysql8.0:SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

    忽然注意到的情况: 2018/7/19至2018/9/13之间发布的7.1.20.7.1.21.7.1.22和7.2.8.7.2.9.7.2.10这六个版本提供的对caching_sha2_passw ...

  6. Warning: mysqli_connect(): The server requested authentication method unknown to the client [caching_sha2_password]报错解决方法

    错误: 解决方法:

  7. PHP Warning: mysqli_connect(): The server requested authentication method unknown to the client [caching_sha2_password] in /usr/local/php/CreateDB.php on line 5

    原因:php还不支持mysql8.0最新的密码加密方式 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ' ...

  8. PHP连接mysql8.0出错“SQLSTATE[HY000] [2054] The server requested authentication method unkno…

    今天安装安装一个叫得推校园O2O系统的使劲都说连接不上服务器. 下面是安装说明,我直接进行3步骤,导入数据库配置文件,结果就显示题目报错的内容 安装说明: 直接输入程序目录即可 http://loca ...

  9. PHP连接mysql8.0出错“SQLSTATE[HY000] [2054] The server requested authentication method unknow.....

    这个错可能是mysql默认使用 caching_sha2_password作为默认的身份验证插件,而不再是 mysql_native_password,但是客户端暂时不支持这个插件导致的. 解决方法一 ...

随机推荐

  1. webDriver API——第14部分Color Support

    class selenium.webdriver.support.color.Color(red, green, blue, alpha=1) Bases: object Color conversi ...

  2. Android常用异步任务执行方法

    Handler原理及基本概念 Message 意为消息,发送到Handler进行处理的对象,携带描述信息和任意数据. MessageQueue 意为消息队列,Message的集合. Looper 有着 ...

  3. ES6 WeakMap Map 区别

    WeakMap与Map的区别 1.WeakMap只接受对象作为键名(null除外),不接受其他类型的值作为键名. 2.WeakMap的键名所指向的对象,不计入垃圾回收机制. 示例: const wm ...

  4. win10下Visual Studio 2015,C++ x64编译zmq

    PS.本人编译过程踩得坑,记录备忘 下载:(1)官网:http://zeromq.org/intro:get-the-software,有简明的编译方式,cmake的,这里不多赘述 (2)到GitHu ...

  5. Linux 压缩文件的命令行总结

    Linux压缩文件的读取 ·    *.Z       compress 程序压缩的档案: ·    *.bz2     bzip2 程序压缩的档案: ·    *.gz      gzip 程序压缩 ...

  6. etymology-F

    forsake [fə'seɪk] vt.放弃:断念. watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400 ...

  7. C语言之文件操作08——总结

    C程序的文件操作共涵盖7个例题,包括格式打印,文件读取,条件查找,矩阵的文件操作,数据格式输入及调用计算等内容. 文件操作使得程序有更强的拓展性,使其能够单独保存数据.这为程序的调试和优化打下了坚实的 ...

  8. Swift新手教程12-可选链

    可选链 原创Blog,转载请注明出处 我的博客地址 http://blog.csdn.net/hello_hwc 可选链提供一个一种可选的方式訪问对象的属性.方法.下标脚本,可选链的返回值一定是可选类 ...

  9. vivado笔记

    Vivado主界面 Vivado套件,相当于把ISE.ISim.XPS.PlanAhead.ChipScope和iMPACT等多个独立的套件集合在一个Vivado设计环境中,在这个集合的设计流程下,不 ...

  10. python学习之items()

    定义 Python 字典 items() 方法以列表返回可遍历的(键, 值) 元组数组. 语法 dict.items() 说明:没有参数. 返回值 返回可遍历的(键, 值) 元组数组. 例子 > ...