HOME/Articles/

mysql example connectMysql (snippet)

Article Outline

Python mysql example 'connectMysql'

Modules used in program:

  • import mysql.connector

python connectMysql

Python mysql example: connectMysql

import mysql.connector

cnx = mysql.connector.connect(user='scott', password='tiger',
                              host='127.0.0.1',
                              database='employees')
cnx.close()