def getConn(conninfo):
host = conninfo['host']
user = conninfo['user']
password = conninfo['password']
port = conninfo['port']
sock = conninfo['sock']
db = conninfo['db']
# print host, user, password, port, db
try:
conn = MySQLdb.Connect(host=host, user=user, passwd=password, port=port, unix_socket=sock, db=db, charset='utf8')
except Exception as e:
print e
sys.exit()
return conn
评论列表
文章目录