简体   繁体   English

MySQL8 - 'caching_sha2_password 需要 SSL'

[英]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.

相关问题 caching_sha2_password mysql 错误 - caching_sha2_password mysql error MySQL服务器为具有标准密码的用户请求了caching_sha2_password - MySQL server requested caching_sha2_password for a user with standard password MySQL 连接器错误:“不支持身份验证插件‘caching_sha2_password’” - MySQL connector error: "Authentication plugin 'caching_sha2_password' is not supported" 将 MySQL 身份验证插件更改为 `caching_sha2_password` - Change MySQL authentication plugin to `caching_sha2_password` MySQL 将身份验证类型从标准更改为 caching_sha2_password - MySQL changing authentication type from standard to caching_sha2_password 由于caching_sha2_password,MySQL 8.0.11连接错误 - MySQL 8.0.11 error connecting due to caching_sha2_password MySql:身份验证方法“caching_sha2_password”失败 - MySql: Authentication method 'caching_sha2_password' failed RMariaDB:连接到MySQL时出现caching_sha2_password错误 - RMariaDB: caching_sha2_password error when connecting to MySQL MySQL 错误:无法加载身份验证插件“caching_sha2_password” - MySQL Error: Authentication plugin 'caching_sha2_password' cannot be loaded 身份验证插件'caching_sha2_password'无法在circleci / mysql中加载 - Authentication plugin 'caching_sha2_password' cannot be loaded in circleci/mysql
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM