1. 程式人生 > >自用python連線資料庫

自用python連線資料庫

connection = pymysql.Connect("localhost","root","password","test")
#connection = pymysql.connect(host='172.0.0.0', port=3306, user='root', password='password', db='test', charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor)
cursor = connection.cursor()

sql = "select"
cursor.execute(sql)

connection.close()