python mysql Connect Pool mysql连接池 (201

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python mysql Connect Pool mysql连接池 (201相关的知识,希望对你有一定的参考价值。

 easy_install mysql-connector-python

>>>import mysql.connector as conner
>>> conn = conner.connect(user="root", passwd="kaimen", db="zentao", port=3306, pool_name = "mypool", pool_size = 3,)
>>> cursor = conn.cursor()
>>> cursor.execute("show tables");
>>> cursor.fetchall()
[(u‘task‘,)]
 
>>> cursor = conn.cursor(cursor_class=conner.cursor.MySQLCursorDict)
>>> cursor.execute("show tables");
>>> cursor.fetchall()
[{u‘Tables_in_zentao‘: u‘task‘}]
 
>>> cursor = conn.cursor(dictionary=True)
>>> cursor.execute("show tables");
>>> cursor.fetchall()
[{u‘Tables_in_zentao‘: u‘task‘}]

以上是关于python mysql Connect Pool mysql连接池 (201的主要内容,如果未能解决你的问题,请参考以下文章

python Python MySQL Connect

Python Connect to MySQL

python 连接mysql 时,connect 出现错误,怎么解决

python连接MySQL

redis性能调优笔记(can not get Resource from jedis pool和jedis connect time out)

学习python3 MySQL数据库语法遇到的问题:"Can't connect to MySQL server on 'localhost'