参考
https://github.com/PyMySQL/mysqlclient
安装 xcode
sh
xcode-select --install
安装mysql
sh
brew uninstall mysql
brew install mysql@8.0
启动 mysql-server 命令如下
sh
brew services start mysql@8.0
安装 mysql-client
sh
brew uninstall mysql-client
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/2f35529519fb6a2cc361ce3d464a1bd181505a54/Formula/m/mysql-client.rb
brew install ./mysql-client.rb
或者
brew install mysql-client@8.0
配置环境变量
sh
export PATH="$(brew --prefix)/opt/mysql-client@8.0/bin:$PATH"
export PATH="$(brew --prefix)/opt/mysql@8.0/bin:$PATH"
export PATH="$(brew --prefix)/opt/llvm/bin:$PATH"
export LDFLAGS="$LDFLAGS -L$(brew --prefix)/opt/llvm/lib"
export CPPFLAGS="$CPPFLAGS -I$(brew --prefix)/opt/llvm/include"
export LDFLAGS="$LDFLAGS -L$(brew --prefix)/opt/mysql-client@8.0/lib"
export CPPFLAGS="$CPPFLAGS -I$(brew --prefix)/opt/mysql-client@8.0/include"
export LDFLAGS="$LDFLAGS -L$(brew --prefix)/opt/mysql@8.0/lib"
export CPPFLAGS="$CPPFLAGS -I$(brew --prefix)/opt/mysql@8.0/include"
export CFLAGS="$CFLAGS -I/usr/local/include -L/usr/local/lib"
export LIBRARY_PATH="$LIBRARY_PATH:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib"
export PKG_CONFIG_PATH="$(brew --prefix)/opt/mysql-client@8.0/lib/pkgconfig"
安装 mysqlclient
sh
pip install mysqlclient