1、
https://blog.csdn.net/msq16021/article/details/113617327
一開始都是這么簡單的寫,並無報錯
db = pymysql.connect("localhost", "root", "196811", "db_student",charset="utf8")
return db # 返回連接對象
遷移服務后,可能是因為mysql版本或者pymysql的版本有變化,導致不能再這么簡單的寫了,傳參規則變得規范了
主要就是將傳參的參數名加上
db = pymysql.connect(host="localhost", user="root", password="196811", database="db_student",charset="utf8mb4")