import pymysql
ratency = 2
conn = pymysql.connect(host="", user="", password="", read_timeout=ratency, write_timeout=ratency)
if conn.open == True:
curs = conn.cursor()
command = "show databases"
curs.execute(command)
rows = curs.fetchall()
print(rows)
conn.close()
''' case of using Dict type
cursor = conn.cursor(pymysql.cursors.DictCursor)
sql = 'select * from some_talbe'
cursor.execute(sql)
result = cursor.fetchall()
print(result)
'''
else:
print("can not connected")
'Python' 카테고리의 다른 글
Getting snmp informations with python script (0) | 2020.04.22 |
---|---|
USING THREAD IN PYTHON (0) | 2020.04.07 |
CRAWLING WITH PYTHON (0) | 2020.04.07 |
TRY TO CONNECT VIA SMB OR CIFS (0) | 2020.04.07 |
TRY TO TEST FOR DEFAULT ACCOUNT VIA TELNET (0) | 2020.04.07 |