查了下,出现这个错误的原因是从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. Android Exception 12(has leaked ServiceConnection)

    09-09 15:12:31.154: E/ActivityThread(18855): Activity com..xxx.xx.act.LoadingAct has leaked ServiceC ...

  2. Linux 系统目录结构(转)

    登录系统后,在当前命令窗口下输入命令:  ls /  你会看到如下图所示: 树状目录结构: 以下是对这些目录的解释: /bin:bin是Binary的缩写, 这个目录存放着最经常使用的命令. /boo ...

  3. Android开发之应用程序更新实现

    近期给项目app做升级.对Android应用程序更新稍有研究,分享一下我的心得. 既然是更新,那么一定是要联网和下载的.所以联网和存储訪问权限时一定要有的: <!-- 权限申请 -->   ...

  4. 【Linux】Ctentos下载

    百度输入:Download Centos 在百度搜索Download Centos然后进入Centos下载官网 点击上述标记的Download Centos,则会出现如下界面,并且点击"Mo ...

  5. mongodb - Replication Set成员维护

    1.添加复制集成员 ybb:PRIMARY> rs.add("cc.example.com:27020") { "ok" : 1 } ybb:PRIMAR ...

  6. LAMP架构三

    PHP相关配置 1.查找php配置文件/usr/local/php/bin/php -i或者phpinfo() [root@bogon admin]# /usr/local/php/bin/php - ...

  7. The Way to Go读书笔记_第4章_基本结构和基本数据类型

    “_”标识符 _ 本身就是一个特殊的标识符,被称为空白标识符.它可以像其他标识符那样用于变量的声明或赋值(任何类型都可以赋值给它),但任何赋给这个标识符的值都将被抛弃,因此这些值不能在后续的代码中使用 ...

  8. python学习之items()

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

  9. PHPEXCEL在thinkphp中封装成类使用

    PHPEXCEL在thinkphp中封装成类使用 标签: phpexcel导出导入thinkphp -- : 435人阅读 评论() 收藏 举报 分类: php() 版权声明:本文为博主原创文章,未经 ...

  10. mahout相关介绍

    https://blog.csdn.net/xiaopihaierletian/article/details/72674592 https://www.cnblogs.com/zlslch/p/67 ...