查了下,出现这个错误的原因是从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. ES6 数值扩展

    1.Number.isNan 和 Number.isFinite Number.isNaN()用来检查一个值是否为NaN Number.isNaN(NaN) // true Number.isNaN( ...

  2. 01-spring安装,hello word

    环境搭建 第一步:安装spring 可以参考这个:http://blog.csdn.net/boredbird32/article/details/50932458 安装成功后,重启后有下面这个Spr ...

  3. CI框架下nginx重写规则

    因为: server { listen ; server_name 222.73.130.124; location / { index index.html index.htm index.php; ...

  4. Servlet容器 Jetty

    http://www.oschina.net/p/jettyJetty 是一个开源的servlet容器,它为基于Java的web内容,例如JSP和servlet提供运行环境.Jetty是使用Java语 ...

  5. JS JSOP跨域请求实例详解

    JSONP(JSON with Padding)是JSON的一种“使用模式”,可用于解决主流浏览器的跨域数据访问的问题.这篇文章主要介绍了JS JSOP跨域请求实例详解的相关资料,需要的朋友可以参考下 ...

  6. Android studio 使用心得(六)—android studio 如何加载.so文件

    之前一直没怎么注意,以为.so文件android为像eclipse一样直接加载,但是直到昨天我在android studio上调试公司项目推送消息的时候,才发现,.so文件原来没有加载成功. 可能之前 ...

  7. intellij idea中修改代码生成的模板

    File -- Settings -- Editor -- Code Style -- File and Code Templates 主要是修改了注释 /** * ${DESCRIPTION} * ...

  8. memcahced&redis命令行cmd下的操作

    一.memcahced   1.安装 执行memcached.exe -d install 把memcached加入到服务中 执行memcached.exe -d uninstall 卸载memcac ...

  9. QT界面 理解QStyle和QStyleOption以及QStyleFactory

    QStyleOption类和QStyle类简介 QStyleOption类存储QStyle函数使用的参数.QStyleOption及其子类包含了QStyle函数绘制图形元素所需的所有信息. 由于性能原 ...

  10. ORACLE / PLSQL 插入或更新数据的几种方式

    第一种,直接用values 插入 ---日期需要用TO_DATE操作 INSERT INTO EMP (EMPNO,ENAME ,JOB,MGR, HIREDATE , SAL ,COMM, DEPT ...