python mysql

By | March 25, 2019

Python MySQL -: For connecting a database we are using My SQL in python programming.For creating a  applications connecting with the databases is the necessity for the programming languages. Python allows us to connect our application to the databases like MySQL, SQLite, MongoDB, and many others. We can download a free MySQL database at click here 

Introduction -:  MySQL Connector/Python is the glue that is used between a Python program and a MySQL Server database. It can be used to manipulate the database objects using data definition language (DDL) statements as well as to change or query the data through data manipulation language (DML) statements.

We can also call MySQL Connector/Python a database driver. It is the official MySQL connector for Python, developed and maintained by Oracle Corporation by the MySQL development team. It effectively supports three different APIs, although only two are commonly used directly.

The MySQL Connector/Python versions, editions, and the three APIs.

VERSIONS
Before 2012, there was no Python connector maintained by Oracle. There were other third-party connectors, such as the MySQL-python (MySQLdb) interface; however, it was getting aged and only officially supported up to MySQL 5.5 and Python 2.7.

MySQL decided to develop its own connector: MySQL Connector/Python. It was written to be compatible with the MySQL-python interface and to be up to date with the latest MySQL Server and Python versions. The initial general availability (GA) release was version 1.0.7, which was released in September 2012. A major update occurred with version 2.1; it introduced the C Extension which allows better performance. The latest GA release as of April 2018 is version 8.0.11, which additionally introduces the X DevAPI.

MySQL products are available in two different editions. First is the  Community and second is the Enterprise. The Enterprise Edition is a commercial offering from Oracle. The difference between the two editions varies among the products. For example, for MySQL Server, several additional plugins are available for the Enterprise Edition. For MySQL Connector/Python, the difference is subtler.

There are effectively three different APIs that can be used in MySQL Connector/Python.

  • Connector/Python API
  • C Extension API
  • X DevAPI

Downloading -: There are many option available for Downloading MySQL Connector/Python.We can download a free MySQL database at click here 

 

Installation MySQL Connector/Python-: MySQL Connector/Python supports several ways to install the connector. The available methods depend on the operating system. The steps should give few surprises if we are used to installing software.

PIP –All Platform-: This way install MySQL Connector/Python if we use the Community Edition is to use the pip command to install the package from the Python Packaging Authority (PyPa). This ensures that any potential dependencies are resolved automatically and the same installation method can be used across all platforms where we need MySQL Connector/Python.

The pip command is available as part of the normal Python installation for Python version 2.7.9 and later if we downloaded Python from https://www.python.org/ Noticeable exceptions are some Linux distributions such as RedHat Enterprise Linux, Oracle Linux, and CentOS Linux., which still use relatively old versions of Python.

INSTALLING PIP ON THE REDHAT FAMILY OF LINUX

Installing pip on the Redhat family of Linux-: The best way to install the pip command on Oracle Linux, RedHat Enterprise Linux and CentOS is to use the EPEL Yum repository. The following steps are here..

  1. Download the EPEL repository definition from https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm .
  2. Install the downloaded EPEL RPM.
  3. Install the python-pip and python-wheel packages.
  4. Let pip upgrade itself using the pip install –upgrade pip command.

The python-wheel package provides support for the wheel built-package format used for Python packages.

MySQL Installer for Microsoft Windows-: MySQL installer for Microsoft  windows sidebar for instructions. The first step is to launch MySQL Installer. The first time we use the installer, we will be asked to accept the license terms. Then we will be taken to a screen where we can choose which MySQL products we want to install.

MySQL Server: MySQL Connector/Python is not worth much on its own. We have a MySQL Server instance to connect to, we shall be limited to doing things such as checking the version If we  do not already have access to an installation of MySQL Server, we will also need to install it.

The installation process of MySQL Server is similar to the steps described for MySQL Connector/Python if we use the MySQL Installer or the MySQL Yum repository. In both of these cases, the installer will set up MySQL for us.There is an option to install using a zip archive on Microsoft Windows or a tar archive on Linux, macOS, Oracle Solaris, and FreeBSD.

 

Leave a Reply

Your email address will not be published. Required fields are marked *