安装Connector/Python:# wget http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-1.0.11.zip
# unzip mysql-connector-python-1.0.11.zip
# cd mysql-connector-python-1.0.11
# python setup.py install
测试Connector/Python是否装上:>>> from distutils.sysconfig import get_python_lib
>>> print get_python_lib()
/usr/local/lib/python2.7/site-packages
小实例:[root@obe11g ~]# python
Python 2.7.3 (default, Jul 18 2013, 20:53:58)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-3.1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mysql.connector
>>> cnx = mysql.connector.connect(user="waterbin",password="123",host="192.168.1.115",database="test")
>>> cur=cnx.cursor()
>>> cur.execute("select * from t")
>>> print cur.fetchall()
[(1,)]>>> cnx.close()
MySQL Connector/Python 的详细介绍:请点这里
MySQL Connector/Python 的下载地址:请点这里诊断Oracle RMAN备份慢的原因MySQL 大DML操作建议相关资讯 MySQL Connector/Python
- MySQL Connector/Python 2.1.1 (02/24/2015 09:32:41)
- MySQL 连接Python 的2 种方法 (08/02/2013 12:36:55)
- Python 连接 MySQL 的驱动程序 (12/22/2012 09:08:07)
| - MySQL Connector/Python 1.2 alpha (12/24/2013 08:38:55)
- MySQL Connector/Python 1.0.8 GA (12/22/2012 09:16:14)
- Connector/Python 1.0.6b2 beta 发 (09/08/2012 11:30:56)
|
本文评论 查看全部评论 (0)