In Rails 6, how do I add "protocol" into my db configs?

Viewed 45

I have my MySql 5.7 db running on a virtual server, whose port 3306 is forwarded to my local . I can connect using this

> mysql -h localhost --protocol=tcp -u mouser mydb_test -p

Which would fail if the params “--protocol=tcp” weren’t present. As such, I’m trying to figure out how to add “protocol” into my database.yml config for Rails 6. I discovered the below is not the way to do it

test:
  adapter: mysql2
  encoding: utf8
  host: localhost
  database: mydb_test
  pool: 5
  username: mouser
  password: mypass
  protocol: tcp
  variables:
    sql_mode: NO_ENGINE_SUBSTITUTION

Since I get connection errors when attempting to connect to the db.

0 Answers
Related