KEMBAR78
Python Programming Part 8 - MYSQL.pptx
Section: BS in Information Technology - 2A
Day: FRI
Time: 1:00-4:00
Instructor: Percival A. Fernandez, MSIT
PYTHON + MYSQL
• This section shows you how to use MySQL Connector/Python to
access MySQL databases.
• You’ll learn how to connect to MySQL database and perform
common database operations such as SELECT, INSERT, UPDATE
and DELETE in Python
GETTING STARTED WITH 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 is designed specifically to MySQL. It
supports all MySQL extensions 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.
GETTING STARTED WITH MYSQL PYTHON
CONNECTOR
• MySQL Connector/Python versions
• You will need to install the correct versions of Python, MySQL,
and Connect/Python. The following table illustrates the
compatible versions of Connect/Python, MySQL, and Python:
Connector/Pyth
on Version
MySQL Server Versions Supported Python
Versions
8.0 8.0, 5.7, 5.6, 5.5 3.6, 3.5, 3.4, 2.7
2.2 5.7, 5.6, 5.5 3.5, 3.4, 2.7
2.1 5.7, 5.6, 5.5 3.5, 3.4, 2.7, 2.6
2.0 5.7, 5.6, 5.5 3.5, 3.4, 2.7, 2.6
1.2 5.7, 5.6, 5.5 (5.1, 5.0,
4.1)
3.4, 3.3, 3.2, 3.1, 2.7, 2.6
INSTALLING MYSQL CONNECTOR/PYTHON
• Before installing MySQL Connector/Python, you need:
Root or Administrator privileges in order to perform the
installation.
Python installed on your system
Note that the MySQL Connector/Python installation requires
python to be in the system’s PATH or it will fail.
• The pip command allows you to install MySQL Python connector
on any Operating system including Windows, macOS, Linux,
and Unix:
INSTALLING MYSQL CONNECTOR/PYTHON
INSTALLING MYSQL CONNECTOR/PYTHON
• 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 the MySQL database server without any
issues.
• To verify the installation, you use the following steps:
• Open Python command line
• Type the following code
INSTALLING MYSQL CONNECTOR/PYTHON
CONNECTING TO MYSQL DATABASE USING CONNECT()
FUNCTION
REFERENCES:
• https://www.python.org/about/gettingstarted/
• https://www.tutorialspoint.com/python/index.htm
• https://www.geeksforgeeks.org/python-programming-language/
• https://www.w3schools.com/python/default.asp
• https://www.codecademy.com/pages/learn-python-with-pro
• https://www.pythontutorial.net/tkinter/

Python Programming Part 8 - MYSQL.pptx

  • 1.
    Section: BS inInformation Technology - 2A Day: FRI Time: 1:00-4:00 Instructor: Percival A. Fernandez, MSIT
  • 3.
    PYTHON + MYSQL •This section shows you how to use MySQL Connector/Python to access MySQL databases. • You’ll learn how to connect to MySQL database and perform common database operations such as SELECT, INSERT, UPDATE and DELETE in Python
  • 5.
    GETTING STARTED WITHMYSQL 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 is designed specifically to MySQL. It supports all MySQL extensions 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.
  • 6.
    GETTING STARTED WITHMYSQL PYTHON CONNECTOR • MySQL Connector/Python versions • You will need to install the correct versions of Python, MySQL, and Connect/Python. The following table illustrates the compatible versions of Connect/Python, MySQL, and Python: Connector/Pyth on Version MySQL Server Versions Supported Python Versions 8.0 8.0, 5.7, 5.6, 5.5 3.6, 3.5, 3.4, 2.7 2.2 5.7, 5.6, 5.5 3.5, 3.4, 2.7 2.1 5.7, 5.6, 5.5 3.5, 3.4, 2.7, 2.6 2.0 5.7, 5.6, 5.5 3.5, 3.4, 2.7, 2.6 1.2 5.7, 5.6, 5.5 (5.1, 5.0, 4.1) 3.4, 3.3, 3.2, 3.1, 2.7, 2.6
  • 7.
    INSTALLING MYSQL CONNECTOR/PYTHON •Before installing MySQL Connector/Python, you need: Root or Administrator privileges in order to perform the installation. Python installed on your system Note that the MySQL Connector/Python installation requires python to be in the system’s PATH or it will fail. • The pip command allows you to install MySQL Python connector on any Operating system including Windows, macOS, Linux, and Unix:
  • 8.
  • 9.
    INSTALLING MYSQL CONNECTOR/PYTHON •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 the MySQL database server without any issues. • To verify the installation, you use the following steps: • Open Python command line • Type the following code
  • 10.
  • 11.
    CONNECTING TO MYSQLDATABASE USING CONNECT() FUNCTION
  • 12.
    REFERENCES: • https://www.python.org/about/gettingstarted/ • https://www.tutorialspoint.com/python/index.htm •https://www.geeksforgeeks.org/python-programming-language/ • https://www.w3schools.com/python/default.asp • https://www.codecademy.com/pages/learn-python-with-pro • https://www.pythontutorial.net/tkinter/