HOME/Articles/

mysql example python create db (snippet)

Article Outline

Python mysql example 'python create db'

Modules used in program:

  • import mysql.connector

python python create db

Python mysql example: python create db

import mysql.connector

conn = mysql.connector.connect(
  host="localhost",
  user="root",
  passwd=""
)

db_cursor = conn.cursor()
db_cursor.execute("CREATE DATABASE data_logger")