[英]MySQL8 – 'caching_sha2_password requires SSL'
I have changed to Mysql8 on my server.我已在我的服务器上更改为 Mysql8。 I connect to the server through ssh.我通过 ssh 连接到服务器。 With (eg) VScode Database explorer I can use the on the server, but from Python3 with MySQL connector, I don't.使用(例如)VScode 数据库资源管理器,我可以在服务器上使用,但是从带有 MySQL 连接器的 Python3 开始,我没有。
On sever side, 'ssl_disabled=True,' solved the problem, but on my computer, I can not connect to the server's db.在服务器端,“ssl_disabled=True”解决了这个问题,但在我的电脑上,我无法连接到服务器的数据库。
import mysql.connector
from mysql.connector import Error
def create_connection():
connection = None
try:
connection = mysql.connector.connect(
host='host',
port='port',
user='user',
passwd='passwd',
database='db',
ssl_disabled=True,
)
print("Connection to MySQL DB successful")
except Error as e:
print(f"Error in create_connection -->\n '{e}'")
return connection
create_connection()
I try to run this and get:我尝试运行它并得到:
'caching_sha2_password requires SSL'
I solved it, If I use port 3307 instead of 3306, it works from the local machine, too!我解决了,如果我使用端口 3307 而不是 3306,它也可以在本地机器上工作!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.