import pymysql from dbutils.pooled_db import PooledDB connect_mysql = { "host": "IP地址", "port": 3306, "charset": "utf8", "db": "数据库名称", "user": "用户名", "passwd": "密码" } #创建连接池 pool = PooledDB(pymysql,15,**connect_mysql) db = pool.connection() cur = db.cursor() select_comment = """""" cur.execute(select_comment) data_comment = cur.fetchall() cur.close() db.close() print(data_comment)