升级到 Ubuntu 20.04 (rails) 后无法再连接到 RDS MySQL
Can no longer connect to RDS MySQL after upgrading to Ubuntu 20.04 (rails)
我有时会连接到托管在 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 库和朋友。
它没有用,所以我删除了所有安装的红宝石(我正在使用 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... .
原来我的RDS实例确实太旧了(创建于2015年)
虽然我最近做了最近的SSL CA强制升级。
我无法再连接。
我无法对 MySQL 进行简单的修改,因为我使用的 m1.small 太旧了。并且在我的可用区域中无法切换到 t3.small。在与他们的支持人员核实后,无法切换可用性区域。
所以我拍了一张快照。我将我的快照恢复到 t3.small
在那之后,我可以在我新创建的实例上修改 mysql 版本。
问题已解决。
小小的不方便,用到这个RDS的地方都得更新配置,最后干掉了旧的
我有时会连接到托管在 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 库和朋友。
它没有用,所以我删除了所有安装的红宝石(我正在使用 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... .
原来我的RDS实例确实太旧了(创建于2015年) 虽然我最近做了最近的SSL CA强制升级。 我无法再连接。
我无法对 MySQL 进行简单的修改,因为我使用的 m1.small 太旧了。并且在我的可用区域中无法切换到 t3.small。在与他们的支持人员核实后,无法切换可用性区域。
所以我拍了一张快照。我将我的快照恢复到 t3.small 在那之后,我可以在我新创建的实例上修改 mysql 版本。
问题已解决。
小小的不方便,用到这个RDS的地方都得更新配置,最后干掉了旧的