canglongdao

python3连接数据库mysql,并进行查询;python3操作mysql流程图;

安装navicat for mysql,参考:https://www.jianshu.com/p/2494e02caf63

import pymysql
ecshop=pymysql.connect(\'localhost\',\'root\',\'root\',\'ecshop\') #连接数据库
cus=ecshop.cursor() #创建游标对象
cus.execute("SELECT VERSION()") #执行sql查询
#print(dir(cus))
datas=cus.fetchone() #获取单条数据
print(datas)
ecshop.close() #关闭数据库
#print(dir(ecshop))

python3操作mysql流程图如下:

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-08-26
  • 2022-12-23
  • 2022-02-08
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-13
  • 2021-11-26
  • 2021-11-21
  • 2022-03-08
  • 2021-05-22
  • 2022-12-23
相关资源
相似解决方案