【问题标题】:Can no longer connect to RDS MySQL after upgrading to Ubuntu 20.04 (rails)升级到 Ubuntu 20.04 (rails) 后无法再连接到 RDS MySQL
【发布时间】:2020-05-05 01:10:04
【问题描述】:

我有时会连接到托管在 AWS RDS 上的远程 MySQL。

但是由于我已经升级到 Ubuntu 20.04,ruby 不再能够连接到 RDS/MySQL

收到此错误。

SSL connection error: error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol (Mysql2::Error::ConnectionError)
  /home/mathieu/.rvm/rubies/ruby-2.5.8/lib/ruby/gems/2.5.0/gems/mysql2-0.5.3/lib/mysql2/client.rb:90:in `connect'
  /home/mathieu/.rvm/rubies/ruby-2.5.8/lib/ruby/gems/2.5.0/gems/mysql2-0.5.3/lib/mysql2/client.rb:90:in `initialize'
  /home/mathieu/.rvm/rubies/ruby-2.5.8/lib/ruby/gems/2.5.0/gems/activerecord-5.0.7.2/lib/active_record/connection_adapters/mysql2_adapter.rb:25:in `new'
  /home/mathieu/.rvm/rubies/ruby-2.5.8/lib/ruby/gems/2.5.0/gems/activerecord-5.0.7.2/lib/active_record/connection_adapters/mysql2_adapter.rb:25:in `mysql2_connection'

我的第一反应是删除mysql2 gem并重新安装它,所以C扩展使用当前安装的openssl库和朋友。

它没有用,所以我删除了所有已安装的 rubies(我正在使用 rvm) 我已经重新安装了它们。

我在命令行上也遇到同样的错误,除非我禁用 SSL

$ mysql -u foo1mysql -p -h foo1mysql.us-east-1.rds.amazonaws.com foo1mysql_staging 
Enter password: 
ERROR 2026 (HY000): SSL connection error: error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol

$ mysql -u foo1mysql -p -h foo1mysql.rds.amazonaws.com foo1mysql --ssl-mode=disabled
Enter password: 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 20933
Server version: 5.6.41-log Source distribution

mysql> select count(*) from accounts;
+----------+
| count(*) |
+----------+
|       20 |
+----------+
1 row in set (0.37 sec)

mysql> ^DBye

$ mysql -u foo1mysql -p -h foo1mysql.rds.amazonaws.com foo1mysql --ssl-mode=required
Enter password: 
ERROR 2026 (HY000): SSL connection error: error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol
$ 

现在我正在考虑通过我的 config/database.yml 指定 ssl_mode=disabled,但最好启用 SSL。

还有其他人遇到过这个问题吗?我可以在 RDS 上启用一些参数吗?

在 serverfault 上找到了这个相关的问题 https://serverfault.com/questions/1014747/cant-connect-to-remote-mysql-5-6-server-from-local-mysql-8-0-client-ssl-protoc

评论中有人建议我升级 RDS 实例上的 MySQL 服务器。从 5.6.41 到 5.6.46,但显然我不能,因为我在 m1.small 上,并且由于某些不同的 RDS 原因,我不能移动到 t2.small 或 t3.small....

【问题讨论】:

    标签: mysql ruby-on-rails ruby ssl rds


    【解决方案1】:

    原来我的 RDS 实例确实太旧了(创建于 2015 年) 虽然我最近做了最近的 SSL CA 强制升级。 我无法再连接。

    我无法对 MySQL 进行简单的修改,因为我使用的 m1.small 太旧了。并且在我的可用区域中无法切换到 t3.small。并且经过他们的支持验证后,无法切换可用区域。

    所以我做了一个快照。我将我的快照恢复到 t3.small 之后,我可以在我新创建的实例上修改 mysql 版本。

    问题解决了。

    有点不方便,我需要在使用这个RDS的所有地方更新配置,最后我把旧的杀掉了。

    【讨论】:

    • 我遇到了同样的问题:升级到 Ubuntu 20.04.1 后,我无法再连接到我的 AWS RDS 数据库;除非我的实例比你的新:它是 2016 年创建的 db.t2.micro。你是否发现新的 Ubuntu 版本能够连接到 AWS 究竟需要做什么?
    • 我相信这是 TLS 1.0 被删除,或者类似的东西。我完全忘记了对不起。但它是一种旧式连接类型,多年前已被弃用,但在 20.04 正式删除
    • 就我而言,这似乎是防火墙规则的问题。我使用条件,因为既然您命名了这一点,我将进一步调查以了解这些防火墙规则和 TLS 1.0 之间的连接,因为它们可能已连接。谢谢
    猜你喜欢
    • 2020-10-22
    • 2020-09-14
    • 2020-09-09
    • 2020-08-15
    • 2020-08-25
    • 2022-11-10
    • 1970-01-01
    • 2021-02-20
    • 2016-02-20
    相关资源
    最近更新 更多