Load Mac Python import MySQL db

import MySQLdb A solution for those who get an error and cannot read.

The procedure is 3 + α.

(1) Install MySQL-python from the following URL. http://sourceforge.net/projects/mysql-python/ Please download it from, place it in a suitable place, and expand it by double-clicking.

(2) Next, edit site.cfg. Add the following line to "site.cfg".

The content to be added is $ which mysql_config /usr/local/bin/mysql_config ↑ This is it. mysql_config = /usr/local/bin/mysql_config

(3) Type the following command from the console to "Build & Install"

$ python setup.py build
$ sudo python setup.py install

Load "import MySQL db" again from another window.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.macosx-10.5-x86_64/egg/MySQLdb/__init__.py", line 19, in <module>
  File "build/bdist.macosx-10.5-x86_64/egg/_mysql.py", line 7, in <module>
  File "build/bdist.macosx-10.5-x86_64/egg/_mysql.py", line 6, in __bootstrap__
ImportError: dlopen(/Users/me/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.5-x86_64.egg-tmp/_mysql.so, 2): Library not loaded: libssl.1.0.0.dylib
  Referenced from: /Users/me/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.5-x86_64.egg-tmp/_mysql.so
  Reason: image not found

If the above error occurs, execute the following command.

(+α)``` brew unlink openssl && brew link openssl --force


 Load MySQL db from the terminal.

 ![スクリーンショット 2016-03-02 12.34.22.png](https://qiita-image-store.s3.amazonaws.com/0/105887/679c32c5-b115-2c1f-9929-9468bd8efa24.png)

 that's all.


Recommended Posts

Load Mac Python import MySQL db
Save / load in-memory DB with python sqlite3
Python module import
Import python script
python on mac
Summarize Python import
Import Excel file from Python (register to DB)
Touch MySQL from Python 3
Python from or import
python original module import
Use MySQL from Python
Install Python on Mac
Write Python in MySQL
Connect python to mysql
Import tsv with Python
Install Python 3.4 on Mac
Mac environment construction Python
(For myself) Flask_6 (Open db from python, Mysql basic (phpMyAdmin))
Problems and solutions when asked for MySQL db in Python 3
How Python module import works
Import vtk with brew python
Install pygame on python3.4 on mac
Python3 + Django ~ Mac ~ with Apache
Set Up for Mac (Python)
Use MySQL from Anaconda (python)
Access Oracle DB from Python
[Python] Insert ":" in MAC address
Python environment construction For Mac
Update python on Mac to 3.7-> 3.8
Install pandas 0.14 on python3.4 [on Mac]
Notes on installing Python on Mac
Python 3 series installation for mac
[Python] Another way to import
Python # Snap7 Libray Import problem
Using OpenCV with Python @Mac
Connection pooling with Python + MySQL