#!/usr/bin/python # ================================================================== # test MySQLdb # ------------------------------------------------------------------ # sudo apt-get install python-mysqldb # sudo apt-get install python3-mysqldb # ================================================================== import MySQLdb as mydb db = mydb.connect('localhost','root','root','phonebook') cur = db.cursor() cur.execute("SELECT lastname,phonenumber,id FROM info") data = cur.fetchall() for row in data: if row == None: break print(row) db.close()