MySQL Connector/Python 安装、测试
安装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()
By DBA_WaterBin
2013-07-25
Good Luck
MySQL Connector/Python 安装、测试的更多相关文章
- Snippet: Fetching results after calling stored procedures using MySQL Connector/Python
https://geert.vanderkelen.org/2014/results-after-procedure-call/ Problem Using MySQL Connector/Pytho ...
- Installing MySQL Connector/Python using pip v1.5
The latest pip versions will fail on you when the packages it needs to install are not hosted on PyP ...
- MySQL、Hive以及MySQL Connector/J安装过程
MySQL安装 ①官网下载mysql-server(yum安装) wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch. ...
- MySQL Connector/Python 接口 (一)
这里仅介绍 MySQL 官方开发的 Python 接口,参见这里: https://dev.mysql.com/doc/connector-python/en/ Chapter 1 Introduct ...
- MySQL Connector/Python 接口 (二)
连接数据库 本文参见这里,示例如何连接MySQL 数据库. import mysql.connector from mysql.connector import errorcode # 连接数据库需要 ...
- win7 MySQL Connector/Net 安装卸载问题
问题1:卸载MySQL Connector Net 6.9.9 卸载程序无法卸载 方法:注册表搜索 MySQL Connector Net 6.9.9 全部删除 ******************* ...
- MySQL Connector/Python 接口 (三)
本文参见这里. 使用缓冲的 cursor,下例给从2000年加入公司并且还在公司的员工薪水从明天起加15% from __future__ import print_function from dec ...
- mysql案例-sysbench安装测试
一 地址 githup地址https://github.com/akopytov/sysbench二 版本 sysbench 1.0.15 curl -s https://packagecloud.i ...
- Ubuntu & MacOS安装Mysql & connector
Ubuntu & MacOS安装Mysql & connector 1. 安装MySql sudo apt-get install mysql-server apt-get insta ...
随机推荐
- winform拖动无边框窗体
这个无边框拖动船体,代码很少,却总是记不住,于是就在网上搜了这段代码,记录一下,省的再忘 using System; using System.Collections.Generic; using S ...
- 转: memcpy的用法总结
1.memcpy 函数用于 把资源内存(src所指向的内存区域) 拷贝到目标内存(dest所指向的内存区域):拷贝多少个?有一个size变量控制拷贝的字节数:函数原型:void *memcpy(voi ...
- Regularized Linear Regression with scikit-learn
Regularized Linear Regression with scikit-learn Earlier we covered Ordinary Least Squares regression ...
- Configure swagger with spring boot
If you haven’t starting working with spring boot yet, you will quickly find that it pulls out all th ...
- CSU 1559 订外卖
题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82842#problem/E 订外卖 解题思路:定义两个数组,a[]表示满A,b ...
- E - Minimum Cost - POJ 2516(最小费)
题目大意:N个客户,M个供货商,K种商品,现在知道每个客户对每种商品的需求量,也知道每个供货商每种商品的持有量,和供货商把一种商品运送到每个客户的单位花费.现在想知道如果能满足所有客户的最小花费是多少 ...
- 转:ORM框架
转自 程序员成长之路:http://blog.csdn.net/zxc22436/article/details/6875220 对象关系映射(ORM)提供了概念性的.易于理解的模型化数据的方法.OR ...
- 在EF中执行SQL语句
你可能要问,我用EF不就为了避免写SQL吗?如果要写SQL我不如直接用ADO.NET得了.话虽然这么说没错,可有些时候使用EF操作数据还是有一些不方便,例如让你根据条件删除一组记录,如果按照正常的流程 ...
- jquery cycle pugin
插件地址: http://jquery.malsup.com/cycle/ <div id="propaganda"><div id="pgdImg&q ...
- [RxJS] Creation operators: fromEventPattern, fromEvent
Besides converting arrays and promises to Observables, we can also convert other structures to Obser ...