HOME/Articles/

mysql example python connect db (snippet)

Article Outline

Python mysql example 'python connect db'

Modules used in program:

  • import mysql.connector

python python connect db

Python mysql example: python connect db

import mysql.connector

conn = mysql.connector.connect(
  host="localhost",
  user="root",
  passwd=""
)
if conn :
    print("You are connected...")