加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

python基础学习24----使用pymysql连接mysql

发布时间:2020-12-17 00:17:18 所属栏目:Python 来源:网络整理
导读:div class="markdown-here-wrapper" data-md-url="https://i.cnblogs.com/EditPosts.aspx?postid=9830589"gt; h1 id="-pymysql-mysql" style="margin: 20px 0px 10px; padding: 0px; font-weight: bold; color: black; font-size: 24px; border-bottom: 2px

<div class="markdown-here-wrapper" data-md-url="https://i.cnblogs.com/EditPosts.aspx?postid=9830589"&gt;
<h1 id="-pymysql-mysql" style="margin: 20px 0px 10px; padding: 0px; font-weight: bold; color: black; font-size: 24px; border-bottom: 2px solid #aaaaaa;">使用pymysql连接mysql
<h3 id="-pymysql" style="margin: 20px 0px 10px; padding: 0px; font-weight: bold; color: black; font-size: 20px; border-bottom: 1px solid #aaaaaa;">安装pymysql
<p style="margin: 0px 0px 1.2em !important; font-size: 16px; line-height: 1.75em; padding-right: 0.5em; padding-left: 0.5em;">pymysql安装可以通过两种方式


<h5 id="-pip-" style="margin: 20px 0px 10px; padding: 0px; font-weight: bold; color: black; font-size: 16px;">使用pip安装
<p style="margin: 0px 0px 1.2em !important; font-size: 16px; line-height: 1.75em; padding-right: 0.5em; padding-left: 0.5em;">首先简单说一下pip的使用方法

> [settings] >> [Project: python] >> [Project Interpreter] >>+之后搜索pymysql点击安装。

,port=,user=,passwd=,db=,charset=)

) 
effect_row = cursor.execute(,(,)) 
effect_row = cursor.executemany(,[(,),(,)])
conn.commit()


row_1 = cursor.fetchone()
row_n = cursor.fetchmany(n)
row_all = cursor.fetchall()

,mode=) 
cursor.scroll(,mode=) 


cursor.execute()
row_all = cursor.fetchall()


cursor.close()

conn.close()

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读