Mac OS x10.9,mysql and Python related

Source: Internet
Author: User

Mysql:

After upgrading the Mac to osx10.9, MySQL server can not be used, on the Internet to find the data said OSX 10.9 under the server software has been a lot of upgrades, so re-download the appropriate 10.9 MySQL server

: http://dev.mysql.com/downloads/mysql/, open and download the DMG version of osx10.9.

OS X 10.9 is a pure 64-bit operating system. There is no need to register when downloading, find No Thanks, just start my download. can be.

When the download is complete, open System Preferences, click MySQL, and open the server.

PYTHON-MYSQLDB:

Previously said Max OS X installed MySQL, we need to use Python to access the MySQL database, need to install the MySQLdb module, the method is as follows:

Download the MySQLdb module at the following URL:

http://sourceforge.net/projects/mysql-python/

In Mac OS X directly double-click Unzip, command line into the extracted directory, execute python setup.py build

If there is

sh: mysql_config: command not found

Tip, we need to edit the path under MySQL and use vim to open the setup_posix.py

Found it:

mysql_config.path = "mysql_config"

Switch

mysql_config.path = "/usr/local/mysql/bin/mysql_config"

Then execute:

sudo python setup.py install

After the installation succeeds, enter Python into the Python environment at the command line, enter import MySQLdb, and report the following error in my environment:

>>> import MySQLdbTraceback (most recent call last):  File "<stdin>", line 1, in <module>  File "MySQLdb/__init__.py", line 19, in </module><module>    import _mysqlImportError: dlopen(/Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.8-intel.egg/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib  Referenced from: /Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.8-intel.egg/_mysql.so  Reason: image not found

Solution, we build a soft chain on it.

sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

This allows us to install the MySQLdb module in the Python environment of Mac OS X.

Mac OS x10.9,mysql and Python related

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.