python import MySQLdb connection = MySQLdb.connect(host='localhost', user='root', password='123456', database='mydatabase') cursor = connection.cursor() cursor.execute("SELECT * FROM table_name") results = cursor.fetchall() for row in results: print(row) connection.commit() connection.close()


上一篇:
下一篇:
切换中文