安装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()

最新文章

  1. 【异常】No ManagedConnections available within configured blocking timeout
  2. 里面的div怎么撑开外面的div,让高度自适应
  3. Python socket (单线程)
  4. SignalR入门之从外部访问持久性连接或Hub
  5. SQLite详解
  6. Python脚本控制的WebDriver 常用操作 <十一> 操作测试对象
  7. reds pub/sub官方文档翻译
  8. Flask框架获取用户IP地址的方法
  9. 小白日记9:kali渗透测试之主动信息收集(二)四层发现:TCP、UDP、nmap、hping、scapy
  10. Codevs 1140 Jam的计数法 2006年NOIP全国联赛普及组
  11. fragment、ListFragment使用ListView及自定义Listview等初始化操作
  12. SpringMVC经典系列-12基于SpringMVC的文件上传---【LinusZhu】
  13. esp8266驱动液晶屏
  14. 课程9:《hibernate框架开发2016版视频》视频目录
  15. Ext Js 6.2.1 classic grid 滚动条bug解决方案
  16. HashMap的源码分析
  17. vue 插件tab选项卡(转载)
  18. java.security.InvalidKeyException: Illegal key size aes解密失败
  19. xcode工程编译错误:No architectures to compile for
  20. mapreduce基本原理

热门文章

  1. Eclipse开发Android报错Jar mismatch! Fix your dependencies
  2. EXTJS 4.2 资料 控件之btn设置可否点击
  3. 【BZOJ2330】 [SCOI2011]糖果
  4. 使用pd设计表的 多对多的中间表的设计方式, 有图有真相
  5. 高性能图文混排框架,构架顺滑的iOS应用-b
  6. ServiceStack.Redis
  7. C#学习笔记(二)
  8. [转载]LINQ 中的 select
  9. PAT-乙级-1035. 插入与归并(25)
  10. 团体程序设计天梯赛-练习集L1-016. 查验身份证