You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
565 B

11 months ago
# -*- coding: utf-8 -*-
import pymysql
import mysql.connector
# # 建立数据库连接
# conn = mysql.connector.connect(
# host="127.0.0.1", # 数据库主机地址
# user="root", # 数据库用户名
# password="123123", # 数据库密码
# )
# 建立数据库连接
conn = pymysql.connect(
host='127.0.0.1',
user='root',
password='123123',
)
# 创建游标对象
cursor = conn.cursor()
# 创建数据库
cursor.execute("CREATE DATABASE IF NOT EXISTS Aerospace")
# 关闭游标和连接
cursor.close()
conn.close()