I have already installed
I want use MySQL with Django, but after install mysql connect
Install mysql using brew and add it to the path:
$ brew install mysql
$ export PATH=/usr/local/mysql/bin:$PATH
$ sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/lib/libmysqlclient.18.dylib
$ pip install mysqlclient
I have encountered this problem too,below is my step:
1.brew install mysql-connector-c
2.pip install mysqlclient
and then encountered this error,i have Traced the source code,but solved this one then the other error occured.
so i changed the way to install mysqlclient,just :
1.brew install mysql
2.pip install mysqlclient
this worked for me,no any errors occured.
Install mysql-client
instead of mysql
if you don't plan to have mysql
in your computer
brew install mysql-client
echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
pip install mysqlclient
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
For Mac: first download Xcode from App Store and MySqlWorkbench from https://dev.mysql.com/downloads/workbench/
Run the following commands in terminal,
$ brew install mysql
$ export PATH=$PATH:/Applications/MySQLWorkbench.app/Contents/MacOS
$ xcode-select --install
$ pip install mysqlclient
I needed the following to build / install mysqlclient
brew install mysql-client
# mysql-client is not on the `PATH` by default
export PATH="/usr/local/opt/mysql-client/bin:$PATH"
# openssl is not on the link path by default
export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/opt/openssl/lib/"
Then I could pip wheel mysqlclient
/ pip install mysqlclient
successfully
brew install/upgrade/reinstall mysql
brew install mysql-client
export PATH="/usr/local/opt/openssl/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
pip install mysqlclient
works perfectly