MySQL8.0.16修改默认文字编码方法

按照网络上的旧方法,尝试修改了一个晚上,brew重装了好多次mysql了,还没搞定。

找到简书上一个大哥的方法,测试成功,特地写个备忘。

[mysqld]
# Only allow connections from localhost
bind-address = 0.0.0.0
socket = /tmp/mysql.sock
default-storage-engine=INNODB

loose_mysqlx_port=33060

character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'


[client]
default-character-set = utf8mb4
socket = /tmp/mysql.sock

[mysql]
default-character-set = utf8mb4

泪流满面啊