MySQL Connector/Python

MySQL Connector/Python

  MySQL Connector/Python, a self-contained Python driver for communicating with MySQL servers。

  MySQL Connector/Python enables Python programs to access MySQL databases。 It is written in pure Python and does not have any dependencies except for the Python Standard Library.

  MySQL Connector/Python includes support for:

  • Almost all features provided by MySQL Server up to and including MySQL Server version 5.7.

  • Converting parameter values back and forth between Python and MySQL data types, for example Python datetimeand MySQL DATETIME. You can turn automatic conversion on for convenience, or off for optimal performance.

  • All MySQL extensions to standard SQL syntax.

  • Protocol compression, which enables compressing the data stream between the client and server.

  • Connections using TCP/IP sockets and on Unix using Unix sockets.

  • Secure TCP/IP connections using SSL.

  • Self-contained driver. Connector/Python does not require the MySQL client library or any Python modules outside the standard library.

  

 Connector/Python implements the MySQL client/server protocol two ways:

  • As pure Python. This implementation of the protocol does not require any other MySQL client libraries or other components.

  • As a C Extension that interfaces with the MySQL C client library. This implementation of the protocol is dependent on the client library, but can use the library provided by either MySQL Connector/C or MySQL Server packages (see MySQL C API Implementations). The C Extension is available as of Connector/Python 2.1.1.

Code Demo

  

  The connect() constructor creates a connection to the MySQL server and returns a MySQLConnection object.

参考:http://dev.mysql.com/doc/connector-python/en/connector-python-example-connecting.html

原文地址:https://www.cnblogs.com/tekkaman/p/5160930.html