当前位置:网站首页>Create database instance
Create database instance
2022-06-11 16:53:00 【A pig that dotes on Nannan】
from pymysql import *
# Create a database instance
# 1. Establish a database connection
conn = connect(host="192.168.134.101",user="root",password="123456")
# 2. Get cursor object
mycur = conn.cursor()
# 3. Create a database instance , And back to int Result of type ,1 Indicates successful addition , If the database instance already exists , Throw an exception
try:
result = mycur.execute("create database pydb")
print(" The result returned after adding the database instance :",result)
except ProgrammingError as msg:
print(" Exception occurred while adding database instance :",msg)
finally:
# 4. Close cursor
mycur.close()
# 5. Close the connection
conn.close()


边栏推荐
- seed-emulator下进行sql注入攻击(含sql环境配置)
- JSP page initial loading method
- 【pytest学习】pytest 用例执行失败后其他不再执行
- Leetcode 1974. Minimum time to type words using a special typewriter (yes, once)
- 2022安全员-A证考试题模拟考试题库模拟考试平台操作
- 2022年高处安装、维护、拆除考试模拟100题及在线模拟考试
- 美团获得小样本学习榜单FewCLUE第一!Prompt Learning+自训练实战
- 2022 high voltage electrician special operation certificate examination question bank and online simulation examination
- 微服务连接云端Sentinel 控制台失败及连接成功后出现链路空白问题(已解决)
- 关联关系
猜你喜欢

2022高压电工特种作业证考试题库及在线模拟考试

微服务连接云端Sentinel 控制台失败及连接成功后出现链路空白问题(已解决)

485 days, 21 experiences of my remote office sharing | community essay solicitation

Common tools and commands for information collection

C语言:使用.h和.c文件遇到的问题总结

Go quick start of go language (I): the first go program

GemBox.Bundle 43.0 Crack

Global and Chinese molten carbonate fuel cell industry outlook and market panoramic Research Report 2022-2028

Message queue push / pull mode Learning & ActiveMQ and JMS learning

【opencvsharp】opencvsharp_samples.core示例代码笔记
随机推荐
Katalon Studio Enterprise
C语言:使用.h和.c文件遇到的问题总结
485 days, 21 experiences of my remote office sharing | community essay solicitation
Leetcode 450. 删除二叉搜索树中的节点
(validation file) validatejarfile report errors
Switching power supply circuit diagram and principle 12V analysis - detailed version
数据库全量SQL分析与审计系统性能优化之旅
RSP:遥感预训练的实证研究
How to store tree structure in database
2022年R1快开门式压力容器操作考试题库及模拟考试
LeetCode——42. 接雨水(双指针)
每周推荐短视频:菜鸟CEO谈未来物流新赛道
《DAMA数据管理知识体系指南》:章节分值占比
Redis --- 学习 NoSQL 五大类型
7个人生工具:SWOT、PDCA、6W2H、SMART、WBS、时间管理、二八原则
^31原型面试题
Is the stock account recommended by qiniu safe? Is it reliable
LeetCode——24. 两两交换链表中的节点(三指针)
2022 high voltage electrician special operation certificate examination question bank and online simulation examination
Differences between list and set access elements