- Download driver (PyMySQL-0.7.9.tar.gz (md5)) from here
- Extract and copy the folder pymysql into the python Lib folder e.g (C:\Users\MyUsername\AppData\Local\Programs\Python\Python35-32\Lib)
- Copy and run the following example.py
출처 http://stackoverflow.com/questions/35684400/how-to-use-python-3-5-1-with-a-mysql-dtabase#!/usr/bin/env python import pymysql conn = pymysql.connect(host='localhost', port=3306, user='root', passwd='', db='sandbox') cur = conn.cursor() cur.execute("SELECT * FROM users") print(cur.description) print() for row in cur: print(row) cur.close() conn.close()
댓글 없음:
댓글 쓰기