mirror of https://github.com/docker/docs.git
Update develop.md (#17383)
Executing "USE inventory" query instead of closing and connecting again
This commit is contained in:
parent
aeb09066ae
commit
014b05a91e
|
@ -121,15 +121,7 @@ def db_init():
|
|||
|
||||
cursor.execute("DROP DATABASE IF EXISTS inventory")
|
||||
cursor.execute("CREATE DATABASE inventory")
|
||||
cursor.close()
|
||||
|
||||
mydb = mysql.connector.connect(
|
||||
host="mysqldb",
|
||||
user="root",
|
||||
password="p@ssw0rd1",
|
||||
database="inventory"
|
||||
)
|
||||
cursor = mydb.cursor()
|
||||
cursor.execute("USE inventory")
|
||||
|
||||
cursor.execute("DROP TABLE IF EXISTS widgets")
|
||||
cursor.execute("CREATE TABLE widgets (name VARCHAR(255), description VARCHAR(255))")
|
||||
|
|
Loading…
Reference in New Issue