St.Mark
2021-01-20 22:12用pythom、mypysql链接数据库链接不成功求大佬指点
import pymysql
db = pymysql.connect('localhost','root','mkfmkf','mrsoft')
cursor = db.cursor()
cursor.execute('SELECT VERSION')
date = cursor.fetchone()
print('Date:%s'%date)
db.close
Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
===================== RESTART: D:\Python\数据库练习\chage.py =====================
Traceback (most recent call last):
File "D:\Python\数据库练习\chage.py", line 2, in <module>
db = pymysql.connect('localhost','root','mkfmkf','mrsoft')
TypeError: __init__() takes 1 positional argument but 5 were given
>>>
- 点赞
- 回答
- 收藏
- 复制链接分享
3条回答
为你推荐
- Pycharm代码运行成功,但是不显示结果,同样IDLE则可以,有无大佬指点一二?
- python
- 3个回答
- c#使用sql语句模糊查询like后传参数查询结果为空,求大佬指点
- sql
- 1个回答
- dp题,求大佬指点迷津,有币日后定补上
- c++
- 1个回答
- mysql同一个用户root在服务器上创建了一个数据库在服务器用命令可以看到这个数据库,本地用navicat连接却看不到这个数据库求大佬们解释
- spring
- java
- c++
- 4个回答
- kettle连接MYSQL数据库问题
- mysql
- 2个回答
换一换