遇事不决,可问春风,春风不语,谨遵本心|

布都御魂

园龄:3年9个月粉丝:2关注:1

mysql数据库增删改查

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
author:张鑫
date:2021/7/30 11:31
"""
import pymysql
import requests
import re
 
import pymysql
 
connect = pymysql.Connect(
    host='140.210.4.73',
    port=3306,
    user='twipad_cj',
    passwd='bj@#twipad_cj',
    db='tw_ipaddb',
    charset='utf8mb4'
)
cursor = connect.cursor()
# 增加数据
sql1 = 'insert into kasaer(name,age,score) values (1,2,3)'
# 删除数据,1是字符串
# sql='delete from kasaer where name="1"'
# 修改数据
# sql='update kasaer set age=18,score=80 where name="路明非" '
# 查询数据
sql2 = 'select * from kasaer'
data1 = cursor.execute(sql1)
data2 = cursor.execute(sql2)
print(data1)
print(data2)
connect.commit()
print('修改成功')
connect.close()

  

本文作者:布都御魂

本文链接:https://www.cnblogs.com/wolvies/p/15262969.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   布都御魂  阅读(19)  评论(0编辑  收藏  举报
   
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起