Python 3 and MySQL, pythonandmysql

Source: Internet
Author: User

Python 3 and MySQL, pythonandmysql
 

Http://stackoverflow.com/questions/4960048/python-3-and-mysql

Up vote61down votefavorite20

I am using ActiveState Python 3 on Windows and wanted to connect to my MySQL database. I heard thatmysqldbWas the module to use. I can't findmysqldbFor Python 3.

Is there a repository available where the binaries existmysqldb? How can I connect to MySQL in Python 3 on Windows?

Mysql python-3.x
Using improve this question Edited Oct 30 '14 at 17: 29 Martin Thoma13.7k14111226 Asked Feb 10'11 at 16: 47panofish1, 85122345
 
 
Thanks to casevh for the link to the unofficial binaries, but I was too impatient and it appears that the masses are still using python2... so I installed python 2.7 and installed MySQLdb from codegood.com/archives/129-panofish Feb 10 '11
1  
Possible duplicate of MySQL-db lib for Python 3.0? -Itsadok Mar 13 '11
Add a comment
11 Answersactiveoldestvotes
Up vote85down voteaccepted

There are currently a few options for using Python 3 with mysql:

Https://pypi.python.org/pypi/mysql-connector-python

  • Officially supported by Oracle
  • Pure python
  • A little slow
  • Not compatible with MySQLdb

Https://pypi.python.org/pypi/pymysql

  • Pure python
  • Faster than mysql-connector
  • Almost completely compatibleMySQLdb, After callingpymysql.install_as_MySQLdb()

Https://github.com/nakagami/CyMySQL

  • Fork of pymysql with optional C speedups

Https://pypi.python.org/pypi/mysqlclient

  • Django's recommended library.
  • Friendly fork of the original MySQLdb, hopes to merge back some day
  • The fastest implementation, as it is C based.
  • The most compatible with MySQLdb, as it is a fork

Benchmarks here: https://github.com/methane/mysql-driver-benchmarks

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.