下載網址:https://pypi.python.org/simple/mysql-python/
步驟二:在 Python 中輸入下列程式碼:
```python
import MySQLdb
db = MySQLdb.connect(host="127.0.0.1", user="root", passwd="", db="db_test")
cursor = db.cursor()
cursor.execute("select data from table_test")
result = cursor.fetchall()
for record in result:
print record[0], "
"
```
沒有留言:
張貼留言