mysql8.0 链接问题Server sent charset unknown to the client. Please, report to the developers

这个问题就是 mysql 8 的密码验证方式是 caching_sha2_password,而低版本都是 mysql_native_password,所以会出错。
laravel MySQL配置在这里插入图片描述

1、my.cnf 配置文件中 [mysqld] 下添加一行

default-authentication-plugin=mysql_native_password

2、重新构建服务,依次执行:

docker-compose down, docker-compose up -d

运行

 docker container exec -it <container_name or id> /bin/bash 

进入 mysql 所在的容器。登录 root 账号:

 mysql -u root -p <password>

登入 mysql 后依次运行:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
FLUSH PRIVILEGES;

最后,重启服务。

docker restart laradock_nginx_1 laradock_mysql_1 laradock_php-fpm_1 laradock_workspace_1

猜你喜欢

转载自blog.csdn.net/weixin_36851500/article/details/103615394