MYSQLDB Module Installation--MAC system

Source: Internet
Author: User

First, install MySQL in the system

Install package path

http://www.mysql.com/downloads/

MySQL Community Edition

(GPL)
Community (GPL) Downloads


    • MySQL Community Server (GPL)
      (current generally Available release:5.7.16) MySQL Community Server is the world's most popular open source database. DOWNLOAD

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/89/C9/wKioL1gcZ-zS9IwbAAMWTfsDQEM327.png-wh_500x0-wm_3 -wmp_4-s_2568834078.png "title=" screen snapshot 2016-11-04 pm 6.50.00.png "alt=" Wkiol1gcz-zs9iwbaamwtfsdqem327.png-wh_50 "/>

Select the bottom one to download

After download, click directly to make an Ann

After installation

Wulilidemacbook-pro:bin root# MySQL--version

MySQL Command not Foud


Wulilidemacbook-pro:bin root# ln-fs/usr/local/mysql/bin/mysql MySQL

Wulilidemacbook-pro:bin root# /usr/local/mysql/support-files/mysql.server start

Starting MySQL

. success!

Wulilidemacbook-pro:bin root#/usr/local/mysql/support-files/mysql.server SOP

Usage:mysql.server {start|stop|restart|reload|force-reload|status} [MySQL server options]

Wulilidemacbook-pro:bin root# /usr/local/mysql/support-files/mysql.server Stop

Shutting down MySQL

.. success!



2, Installation Mysql-python

Using PIP installation is not a way to modify the files in the installation package, it will always be an error

wulilidemacbook-pro:~ root# pip Install Mysql-python

Collecting Mysql-python

Retrying (Retry (total=4, Connect=none, Read=none, Redirect=none)) After connection broken by ' Readtimeouterror (" Httpsconnectionpool (host= ' pypi.python.org ', port=443): Read timed out. (read timeout=15) ",) ':/simple/mysql-python/

Using Cached Mysql-python-1.2.5.zip

Complete output from command python setup.py egg_info:

Sh:mysql_config:command not found

Traceback (most recent):

File "<string>", line 1, in <module>

File "/private/tmp/pip-build-8vxxdd/mysql-python/setup.py", line +, in <module>

metadata, Options = Get_config ()

File "setup_posix.py", line +, in Get_config

Libs = Mysql_config ("Libs_r")

File "setup_posix.py", line +, in Mysql_config

Raise EnvironmentError ("%s not found"% (Mysql_config.path,))

Environmenterror:mysql_config not found

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in/private/tmp/pip-build-8vxxdd/mysql-python/

Had to choose Source Package installation

Download the source Package

https://pypi.python.org/pypi/MySQL-python/1.2.5

Select Source package download, unzip,

Modify the extracted configuration file

wulilidemacbook-pro:mysql-python-1.2.5 root# pwd

/users/wulili/downloads/mysql-python-1.2.5

wulilidemacbook-pro:mysql-python-1.2.5 root# Ls-l

Total 336

[Email protected] 1 Wulili staff 18092 Oct 8-GPL-2.0

[Email protected] 1 Wulili staff 5687 Jan 1

[Email protected] 1 Wulili staff 6636 Oct 8 INSTALL

[Email protected] 1 Wulili staff 309 Jan 2 manifest.in

[Email protected] 6 Wulili staff 204 Nov 4 18:34 Mysql_python.egg-info

Drwxr-xr-x 9 Wulili Staff 306 Nov 4 18:34 MySQLdb

[Email protected] 1 Wulili staff 1689 Jan 2 Pkg-info

[Email protected] 1 Wulili staff 1266 Oct 4-readme.md

[Email protected] 1 Wulili staff 84709 Jan 2 _mysql.c

[Email protected] 1 Wulili staff 2352 Oct 8-_mysql_exceptions.py

Drwxr-xr-x Wulili Staff 408 Nov 4 18:34 doc

[Email protected] 1 Wulili staff 2039 Jan 2 metadata.cfg

[Email protected] 1 Wulili staff 3203 Oct 8-pymemcompat.h

[Email protected] 1 Wulili staff 398 Jan 2 setup.cfg

[Email protected] 1 Wulili staff 609 Jan 2 setup.py

[Email protected] 1 Wulili staff 1088 Oct 8-setup_common.py

[Email protected] 1 Wulili staff 3392 Jan 2 setup_posix.py

[Email protected] 1 Wulili staff 1334 Oct 8-setup_windows.py

[Email protected] 1 Wulili staff 665 Oct 8-site.cfg

Drwxr-xr-x 8 Wulili Staff 272 Nov 4 18:34 tests

wulilidemacbook-pro:mysql-python-1.2.5 root# Vim setup_posix.py

wulilidemacbook-pro:mysql-python-1.2.5 root# Vim setup_posix.py


Raise EnvironmentError ("%s not found"% (Mysql_config.path,))

Return data

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


Def get_config ():

From Setup_common import get_metadata_and_options, enabled, Create_release_file




wulilidemacbook-pro:mysql-python-1.2.5 root# Vim Site.cfg

# The path to Mysql_config.

# only use this if mysql_config are not on your PATH, or you have some weird

# setup that requires it.

Mysql_config =/usr/local/mysql/bin/mysql_config


# HTTP://STACKOVERFLOW.COM/QUESTIONS/1972259/MYSQL-PYTHON-INSTALL-PROBLEM-USING-VIRTUALENV-WINDOWS-PIP

# Windows Connector libs for MySQL. You need a 32-bit connector for your 32-bit Python build.

Connector = C:\Program Files (x86) \mysql\mysql connector C 6.0.2

After modification, install it.

wulilidemacbook-pro:mysql-python-1.2.5 root# python setup.py install



wulilidemacbook-pro:mysql-python-1.2.5 root# python

Python 2.7.10 (default, Oct 23 2015, 19:19:21)

[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on Darwin

Type "Help", "copyright", "credits" or "license" for more information.

>>> Import MySQLdb

/library/python/2.7/site-packages/mysql_python-1.2.5-py2.7-macosx-10.11-intel.egg/_mysql.py:3: UserWarning: Module _mysql was already imported From/library/python/2.7/site-packages/mysql_ PYTHON-1.2.5-PY2.7-MACOSX-10.11-INTEL.EGG/_MYSQL.PYC, but/users/wulili/downloads/mysql-python-1.2.5 is being added To Sys.path

>>>

Can import success instructions installed

MYSQLDB Module Installation--MAC system

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.