import pymysql db = pymysql.connect(host="rm-2zei6e64c1k486wp1.mysql.rds.aliyuncs.com", port=3306, user="zhuhaoran", passwd="a%fk&^km%HbZu7O$", db="uat_orderdb", charset='utf8') cursor = db.cursor() #使用cursor方法创建一个游标 cur.execute("show tables;") table_number = cur.fetchall() print(table_number) cursor.close() db.close()