# 连接mysql

import pymysql

db = pymysql.connect(host='localhost',user='root', password='<PASSWORD>', port=3306)
cursor = db.cursor()
cursor.execute('SELECT VERSION()')
data = cursor.fetchone()
print('Database version:', data)
cursor.execute("CREATE DATABASE spiders DEFAULT CHARACTER SET utf8")
db.close()
# 连接mysql

import pymysql

db = pymysql.connect(host='localhost',user='root', password='<PASSWORD>', port=3306)
cursor = db.cursor()
cursor.execute('SELECT VERSION()')
data = cursor.fetchone()
print('Database version:', data)
cursor.execute("CREATE DATABASE spiders DEFAULT CHARACTER SET utf8")
db.close()