Created
May 8, 2019 18:09
-
-
Save StephenFordham/a3a4e2ecea526bbbf99c33070952fa53 to your computer and use it in GitHub Desktop.
database_connection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mysql.connector | |
mydb = mysql.connector.connect( | |
host='localhost', | |
user='root', | |
password='******', | |
#database='football_db' | |
) | |
print(mydb) | |
cursor = mydb.cursor() | |
cursor.execute("CREATE DATABASE football_db") | |
cursor.execute('SHOW DATABASES') | |
Output: | |
<mysql.connector.connection.MySQLConnection object at 0x030D98F0> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment