当Mysql的版本为8.0及以上时
如果利用mysql.connector连接Mysql出现如下错误:
mydb = mysql.connector.connect(host="localhost", user="root", passwd="1234", database="rac_ecust")
mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported
可以采用如下方式解决:
mydb = mysql.connector.connect(host="localhost", user="root", passwd="1234", database="rac_ecust", auth_plugin='mysql_native_password')