需要 SSL,但服务器不支持 Rails 与 MariaDB

问题描述 投票:0回答:1

我尝试使用 MariaDB (10.11) 设置我的 Rails (6.1) 服务器,但是当我想创建数据库时出现错误:

ActiveRecord::ConnectionNotEstablished: TLS/SSL error: SSL is required, but the server does not support it
Caused by:
Mysql2::Error::ConnectionError: TLS/SSL error: SSL is required, but the server does not support it

我的默认my.cnf:

#
# This group is read both by the client and the server
# use it for options that affect everything
#
[client-server]

#
# include *.cnf from the config directory
#
!includedir /usr/local/etc/my.cnf.d

我的数据库.yml:

johndoe_dev: &johndoe_dev
  adapter: mysql2
  database: the_wagon
  pool: 25
  socket: /tmp/mysql.sock
  host: localhost
  timeout: 5000
  username: myuser
  password: password
  encoding: utf8mb4
  collation: utf8mb4_unicode_ci
  variables:
    sql_mode: TRADITIONAL

development:
  <<: *default
  <<: *<%= Rails.env.development? ? "#{ENV["USER"]}_dev" : "ai_dev" %>

我尝试了多种解决方案,例如在database.yml中使用

ssl_mode: :disable
停用SSL或在my.cnf中使用
ssl = 0
停用SSL,但没有任何效果

我用

mysql2
安装了
mariadb-connector-c
gem,如果它可以有链接

ruby-on-rails mariadb mysql2
1个回答
0
投票

您尝试过这个ssl_mode:“禁用”吗?

johndoe_dev: &johndoe_dev
  adapter: mysql2
  database: the_wagon
  pool: 25
  socket: /tmp/mysql.sock
  host: localhost
  timeout: 5000
  username: myuser
  password: password
  encoding: utf8mb4
  collation: utf8mb4_unicode_ci
  variables:
    sql_mode: TRADITIONAL
  ssl_mode: 'DISABLED' 

development:
  <<: *johndoe_dev
© www.soinside.com 2019 - 2024. All rights reserved.