使用MySQL
2024-09-02 04:24:38
安装MySQL驱动
使用vpn
$ pip install mysql-connector-python --allow-external mysql-connector-python
import mysql.connector conn = mysql.connector.connect(user='root', password='nana123', database='test')
cursor = conn.cursor() cursor.execute('create table user (id varchar(20) primary key, name varchar(20))')
cursor.execute('insert into user (id, name) values (%s, %s)', ['', 'Michael'])
cursor.rowcount
conn.commit()
cursor.close() cursor = conn.cursor()
cursor.execute('select * from user where id = %s', [''])
values = cursor.fetchall()
print(values) cursor.close()
conn.close()
最新文章
- 【异常】No ManagedConnections available within configured blocking timeout
- 里面的div怎么撑开外面的div,让高度自适应
- Python socket (单线程)
- SignalR入门之从外部访问持久性连接或Hub
- SQLite详解
- Python脚本控制的WebDriver 常用操作 <;十一>; 操作测试对象
- reds pub/sub官方文档翻译
- Flask框架获取用户IP地址的方法
- 小白日记9:kali渗透测试之主动信息收集(二)四层发现:TCP、UDP、nmap、hping、scapy
- Codevs 1140 Jam的计数法 2006年NOIP全国联赛普及组
- fragment、ListFragment使用ListView及自定义Listview等初始化操作
- SpringMVC经典系列-12基于SpringMVC的文件上传---【LinusZhu】
- esp8266驱动液晶屏
- 课程9:《hibernate框架开发2016版视频》视频目录
- Ext Js 6.2.1 classic grid 滚动条bug解决方案
- HashMap的源码分析
- vue 插件tab选项卡(转载)
- java.security.InvalidKeyException: Illegal key size aes解密失败
- xcode工程编译错误:No architectures to compile for
- mapreduce基本原理
热门文章
- Eclipse开发Android报错Jar mismatch! Fix your dependencies
- EXTJS 4.2 资料 控件之btn设置可否点击
- 【BZOJ2330】 [SCOI2011]糖果
- 使用pd设计表的 多对多的中间表的设计方式, 有图有真相
- 高性能图文混排框架,构架顺滑的iOS应用-b
- ServiceStack.Redis
- C#学习笔记(二)
- [转载]LINQ 中的 select
- PAT-乙级-1035. 插入与归并(25)
- 团体程序设计天梯赛-练习集L1-016. 查验身份证