pip install MySQL-python pip install MySQL-python==<version> python import MySQLdb db = MySQLdb.connect(host="localhost", user="root", passwd="password", db="database_name") cursor = db.cursor() cursor.execute("SELECT VERSION()") data = cursor.fetchone() cursor.close() db.close() pip install mysqlclient


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