docker mysql8 注意

1.

mysql8 出了有段时间了,但公司项目的django还不支持mysql8的默认加密方式。

连接时报错

Error : The server requested authentication method unknown to the client [caching_sha2_password]

这是因为mysql5.7 与 8.0 版本 的加密方式不同

因此在升级mysql版本时,需要使用mysql5.7的加密方式,只需在初始化数据库时,指定参数 default-authentication-plugin=mysql_native_password

具体命令  mysql官方文档   

command: ['mysqld', '--default-authentication-plugin=mysql_native_password']

2.

同时为了支持表情符号,使用  utf8mb4 字符集

'--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci', 

猜你喜欢

转载自www.cnblogs.com/duoxuan/p/10115861.html