如何解决错误:Laravel-MySql中未知的SQL身份验证方法 [英] How to resolve the error: SQL authentication method unknown in Laravel-MySql
本文介绍了如何解决错误:Laravel-MySql中未知的SQL身份验证方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用docker,并且有一个容器Laravel Framework 5.5.25和其他容器,以及适用于x86_64(MySQL Community Server-GPL)上用于Linux的mysql Ver 8.0.11.在我的Docker配置中,我有这个:
I using docker and I have a container of Laravel Framework 5.5.25 and other with mysql Ver 8.0.11 for Linux on x86_64 (MySQL Community Server - GPL). in my configuration of docker compose I have this:
version: "2"
services:
mysql:
image: mysql
ports:
- "3307:3306"
command: --sql_mode=""
因此,当Laravel尝试连接到MySql时,出现此错误:
So, when Laravel try to connect to MySql I have this error:
SQLSTATE [HY000] [2054]服务器请求客户端未知的身份验证方法(SQL:从*中选择*
SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from
推荐答案
您必须为MySQL 8和PHP7 +使用旧式密码:
You have to use legacy style passwords for MySQL 8 and PHP7+:
ALTER USER 'username'@'ip_address' IDENTIFIED WITH mysql_native_password BY 'password';
这篇关于如何解决错误:Laravel-MySql中未知的SQL身份验证方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文