输入banner图图片脚本导航/分类

Python MySQL - 创建/查询/删除数据库

coding=utf-8 import mysql.connector import importlib import sys #连接数据库的信息 mydb = mysql.connector.connect( host=‘115.xx.10.121‘, port=‘3306‘, user=‘root‘, password=‘xxxxxZ6XPXbvos‘, ) mycursor=mydb.cursor() #创建数据库 mycursor.execute(‘create database test_cc‘) #查询数据库 mycursor.execute(‘show databases‘) for x in mycursor: if ‘test_cc‘ in x: print ‘成功‘ #删除数据库 mycursor.execute(‘drop database test_cc‘)

 

Python MySQL - 创建/查询/删除数据库

标签:0.12   int   xxxx   importlib   nec   数据   use   创建   style