突然想起了世界上最优雅的语言python
(why 最优雅,因为强制缩进,看起来的确比较好看)
1,先装MySQLdb库,官方下载的不行,搜到这个
http://www.codegood.com/archives/4
2,遇到__init__.py什么什么的错误,
神级帖子save me http://www.phpfans.net/article/htmls/200907/MjE1MjQ5.html
找到MySQLdb文件夹的中__init__.py,注释掉from sets import ImmutableSet
class DBAPISet(ImmutableSet):添加class DBAPISet(frozenset):;找到converters.py注释掉from sets import BaseSet, Set。然后修改第45行和129行中的Set为set。
3,开始读取book数据库
import MySQLdb
conn=MySQLdb.connect(host="localhost",user="root",passwd="744411",db="book")
cursor=conn.cursor()
cursor.execute("select * from book")
res=cursor.fetchall()
print res
cursor.close()
conn.close()
- 大小: 106.9 KB
分享到:
相关推荐
python在windows中连接mysql的驱动MySQL-python-1.2.2.win32-py2.6 快速,安全,稳定
天在电脑上安装MySQLdb的时候,使用该软件可直接将python2.6与mysql关联。
MySQL python-1.2.2.win32-py2.6.rar python 连接 mysql用module MySQL python-1.2.2.win32-py2.6.rar python 连接 mysql用module
在http://sourceforge.net/projects/mysql-python下载的用于python2.6的mysqldb
MySQL-python-1.2.5.win32-py2.6
工欲齐善必先利其器,Win下的python插件神器,找了很久才找到的,值得收藏
MySQL-python-1.2.2.win-amd64-py2.6,好不容易才找到的
请先安装python2.6 我的资源中有的下。再安装。这个安装包,
MySQL-python-1.2.3.win32-py2.6
mysqldb python2.6 windows 打包成exe了 缺的两个dll libmmd.dll libguide40.dll 也都在里面
python2.6-MySQLdb,包括python2.6安装包、MySQLdb for python2.6安装包、MySQLdb使用配置,为想学习Python操作mysql数据库的同学提供了极大的方便。。。
mysqldb官方提供 MySQL-python-1.2.3c1.win32-py2.6.exe
python2.6集成mysqldb完整包
python 2.6 版本 其中适用的mysql模块可以到我的资源中下载,还包括连接mysql时 遇到的错误的解决办法
NULL 博文链接:https://bask.iteye.com/blog/550290
NULL 博文链接:https://pqcc.iteye.com/blog/511588
MySQL-python-1.2.2.win32-py2.4.exe MySQL-python-1.2.2.win32-py2.5.exe MySQL-python-1.2.2.win32-py2.6.exe MySQL-python-1.2.2.tar.gz MySQL_python-1.2.3c1-py2.5-linux-i686.egg 更多到 iteedu.com/download