Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on Rails 5.2.0 Mysql2::Error::ConnectionError SSL connection error: unknown error number

I am new to RoR, but not new to web development in general. I am trying to switch a Rails app from sqlite3 to mysql2, it is api-only. Added the gem to Gemfile, used bundle install, everything fine. I run rails server and see the error bellow: https://i.sstatic.net/wX4Gm.jpg

This is my Database.yml:

default: &default
  adapter: mysql2
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  encoding: utf8
  reconnect: true
  host: 127.0.0.1
  port: 3306
  username: root
  password: 123456
  socket: /tmp/mysql.sock

development:
  <<: *default
  database: beginner_dev

test:
  <<: *default
  database: beginner_test

production:
  <<: *default
  database: beginner_prod
like image 365
C. Gabriel Avatar asked Oct 15 '25 17:10

C. Gabriel


1 Answers

I succeeded to solve the problem by adding the following lines to database.yml, default section:

ssl_mode: :disabled
sslverify: false

The error isn't so descriptive, but apparently it was related to ssl.

like image 80
C. Gabriel Avatar answered Oct 18 '25 06:10

C. Gabriel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!