Environment: Mac,pycharm Editor
1. Use Brew to install MySQL under Mac
Brew Install MySQL
B. View installation Information
Brew Info MySQL
2. Download mysql-python-1.2.3
When the download is complete, go to the mysql-python-1.2.3 folder and execute the following command
Python setup.py Build
You encounter a problem like this: Mysql_config not find similar errors
The setup_posix.py should be modified at this time, after the MySQL installation is complete,
Find the location of the Mysql_config file
sudo find /-name mysql_config
Mysql_config default location/usr/local/bin/mysql_config, so modify to Mysql_config.path = "/usr/local/bin/mysql_config"
And then re-execute
Python setup.py Build
Python setup.py instal
3. Return to the Pycharm editor
After installing the Mysql-python package, let us import mysqldb, there is an error, the last line of error is written reason:image not found.
Workaround in Terminal input:
sudo ln-s/usr/local/cellar/mysql/5.7.10/lib/libmysqlclient.20.dylib/usr/lib/libmysqlclient.20.dylib
Python connection MySQL