Getting Started with MySQL Python Connector
This tutorial helps you get started with MySQL Python connector. You will learn about the MySQL Python connector’s features and how to install MySQL Connector/Python in your local system.
Introduction to MySQL Python connector
To access the MySQL database from Python, you need a database driver. MySQL connector/Python is a standardized database driver provided by MySQL.
MySQL Connector/Python supports almost all features provided by MySQL version 5.7. It allows you to convert parameter’s value between Python and MySQL data types e.g., Python datetime and MySQL DATETIME.
MySQL Connector/Python is designed specific to MySQL. It supports all MySQL extensions to standard SQL such as LIMIT clause.
MySQL Connector/Python allows you to compress the data stream between Python and MySQL database server using protocol compression. It supports connections using TCP/IP socket and secure TCP/IP connection using SSL.
MySQL Connector/Python is an API implemented using pure Python. It means that you don’t need to install any MySQL client library or any Python modules except the standard library.
We will cover the MySQL connector/Python 2.0, which support Python version 2.6, 2.7 and 3.3, in our tutorials.
Download MySQL Python connector
To work with MySQL Python connector, you need to download and install it in your local system. The distribution is available in various platforms such as Mac OS X, Microsoft Windows, Ubuntu Linux. You just need to select the right platform and download.
Installing MySQL Python connector
Installing MySQL Python connector is straightforward. For example, to install it in Windows environment, you use the following steps:
- Unpack the download file into a temporary directory e.g., C:\temp
- Start a console window and switch to the folder where you unpack the connector
- Inside the c:\temp folder, use the following command:
Verifying MySQL Connector/Python installation
After installing the MySQL Python connector, you need to test it to make sure that it is working correctly and you are able to connect to MySQL database server without any issues. To verify the installation, you use the following steps:
- Open Python command line
- Type the following code
If the output is shown as below, you have been successfully installing the MySQL Python connector in your system.
0 comments:
Post a Comment