自动摘要
正在生成中……
查看当前MySQL可用 CHARSET
SHOW CHARACTER SET;
查看可用 COLLATION
SHOW COLLATION;
修改启动参数:vi /usr/local/Cellar/mysql/MYSQL版本/homebrew.mxcl.mysql.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>homebrew.mxcl.mysql</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/opt/mysql/bin/mysqld_safe</string>
<string>--character-set-server=utf8mb4</string>
<string>--collation-server=utf8mb4_general_ci</string>
<string>--bind-address=0.0.0.0</string>
<string>--datadir=/usr/local/var/mysql</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>/usr/local/var/mysql</string>
</dict>
</plist>
另一个方式是修改 配置文件 sudo vi /private/etc/my.cnf
[mysqld]
...
character-set-server=utf8mb4
collation-server=utf8mb4_general_ci
...
参考:https://www.mysqltutorial.org/mysql-collation/