-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase_setup.py
More file actions
26 lines (20 loc) · 774 Bytes
/
database_setup.py
File metadata and controls
26 lines (20 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import mysql.connector
##---------------------------------------------------------
# Use the following code to create a database (for first time use) and then again comment
# the code
# db = mysql.connector.connect( # enter your local mysql server details (user and passwd)
# host = "localhost",
# user = "chessdb",
# passwd = "chess",
# )
# mycursor = db.cursor()
# mycursor.execute("CREATE DATABASE maindatabase")
##---------------------------------------------------------
db = mysql.connector.connect( # enter your local mysql server details (user and passwd)
host = "localhost",
user = "chessdb",
passwd = "chess",
database = "maindatabase"
)
mycursor = db.cursor(buffered=True)
cursorformoves = db.cursor(buffered=True)