当前位置:网站首页>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()


边栏推荐
- Regression prediction | realization of RBF RBF neural network with multiple inputs and single output by MATLAB
- Pycharm使用小技巧 - 如何设置背景图片
- seed-emulator下进行sql注入攻击(含sql环境配置)
- RSP:遥感预训练的实证研究
- Solr (I) installation and permission control of Solr
- 2022 molten welding and thermal cutting work license and simulation examination
- Leetcode 1974. Minimum time to type words using a special typewriter (yes, once)
- jsp页面初始加载方式
- error:指针作为函数参数错误总结
- 2022年安全员-B证国家题库及模拟考试
猜你喜欢

2022起重机司机(限桥式起重机)考试题模拟考试题库及模拟考试

2022年R1快開門式壓力容器操作考試題庫及模擬考試

数据库全量SQL分析与审计系统性能优化之旅

Leetcode 1974. 使用特殊打字机键入单词的最少时间(可以,一次过)

LeetCode——24. 两两交换链表中的节点(三指针)

基于udp端口猜测的内网穿透

Using MATLAB and dcraw to process digital camera raw files

【clickhouse专栏】新建库、用户及角色
![[pytest learning] after the pytest case fails to execute, the others will not be executed](/img/c7/52ae88cde65bdd12ae8b86df5c477f.png)
[pytest learning] after the pytest case fails to execute, the others will not be executed

RSP: An Empirical Study of remote sensing pre training
随机推荐
Report on the operation situation and future prospects of China's gear oil industry (2022-2028)
Rdkit installation
Persistence mechanism of redis
RDKit 安装
Oracle generates non duplicate string sys_ Guid() and MySQL generate unique values
2022安全员-C证特种作业证考试题库及答案
Opencv相机标定之圆形标识点中心检测
ASP. Net education OA system source code education industry OA system source code with document
AXI协议基础知识
如何把树结构存储到数据库
Analysis report on the "fourteenth five year plan" proposal and innovation environment of global and Chinese sodium pyrophosphate industry (2022-2028)
CS0006 C# 未能找到元数据文件“C:\Users\...问题
【pytest学习】pytest 用例执行失败后其他不再执行
Le compte de titres de l'école de commerce kainiu est - il sécurisé? Frais d'ouverture de compte
TypeScript学习笔记(二)
Time series prediction | MATLAB realizes future multi-step prediction of RBF RBF neural network time series
^31 prototype interview questions
【opencvsharp】opencvsharp_samples.core示例代码笔记
^32 execution context stack interview questions
开关电源电路图及原理12v分析-详细版