首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >Python连接Mysql测试

Python连接Mysql测试

原创
作者头像
陈不成i
修改2021-06-21 14:22:36
修改2021-06-21 14:22:36
2.8K0
举报
文章被收录于专栏:ops技术分享ops技术分享
  1. import pymysql
  2. db = pymysql.connect(host="rm-2zei6e64c1k486wp1.mysql.rds.aliyuncs.com", port=3306, user="zhuhaoran", passwd="a%fk&^km%HbZu7O$", db="uat_orderdb", charset='utf8')
  3. cursor = db.cursor() #使用cursor方法创建一个游标
  4. cur.execute("show tables;")
  5. table_number = cur.fetchall()
  6. print(table_number)
  7. cursor.close()
  8. db.close()

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档