Mary
Mary

Reputation: 1142

connecting Canopy to mysql

I am new to Python and using Enthought Canopy Express for learning purpose. As part of that I am looking for an option to connect Canopy to mysql. I did not find any materials. Please share if you know any method that I can use mysql in Canopy Express.

I am using Mac OS X version 10.9

Path for canopy is: /Users/mz/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages

Mysql is version 5.6 with the following path: mysql is /usr/local/mysql/bin/mysql

Upvotes: 0

Views: 622

Answers (1)

Tim D
Tim D

Reputation: 1743

You can use the Canopy Package Manager to install pymysql: enter image description here

Once installed, access pymysql according to the Python PEP249 DB API (create a connection, get a cursor, etc.):

In [1]: import pymysql

In [2]: connection = pymysql.connect?
Signature: pymysql.connect(*args, **kwargs)
Docstring:
        Establish a connection to the MySQL database. Accepts several
        arguments:

        host: Host where the database server is located
        user: Username to log in as
        password: Password to use.
        database: Database to use, None to not use a particular one.
        port: MySQL port to use, default is usually OK.
...

Upvotes: 0

Related Questions