Home>

The SendGrid account for sending emails on Heroku has been frozen, so
Remove the Heroku app and
Create a new Heroku app and
When deploying with the following procedure, an error occurs in db: migrate and I am in trouble.
I would be grateful if anyone could teach me how to solve it.

① Reset host ='.herokuapp.com' in the "/config/environments/production.rb" file
② Execute $git push
③ Run $heroku git: remote -a https://git.heroku.com/〇〇.git
④ Execute $git push heroku
⑤ Run $heroku run rails db: migrate

The following error occurred in this ⑤.
Mysql2 :: Error: Can't connect to local MySQL server through socket'/var/run/mysqld/mysqld.sock' (2)

The versions of rails and mysql specified in the Gemfile are as follows.

gem'rails', '6.0.3'
gem'mysql2','~>0.4.4'

The settings in database.yml are as follows.

# SQLite. Versions 3.8.0 and up are supported.
# gem install sqlite3
#
#Ensure the SQLite 3 gem is defined in your Gemfile
# gem'sqlite3'
#
default:&default
  adapter: sqlite3
  pool:<% = ENV.fetch ("RAILS_MAX_THREADS") {5}%>
  timeout: 5000
development:
<<: * default
  database: db/development.sqlite3
#Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test: test:
<<: * default
  database: db/test.sqlite3
production:
  adapter: mysql2
  encoding: utf8
  # For details on connection pooling, see Rails configuration guide
  pool:<% = ENV.fetch ("RAILS_MAX_THREADS") {5}%>
  database: practice_session_production
  username: practice_session
  password:<% = ENV ['PRACTICE_SESSION_DATABASE_PASSWORD']%>

The result of heroku config is below.

$heroku config
=== takkyurensyukai-bbb Config Vars
LANG: en_US.UTF-8
RACK_ENV: production
RAILS_ENV: production
RAILS_LOG_TO_STDOUT: enabled
RAILS_SERVE_STATIC_FILES: enabled
SECRET_KEY_BASE: 3f326bd0f9f1e294306b5cd1d5a38c5e8534416143bb75f3ceafa576d46f43eb04d61d5a7955064ecefe433388988d9b5c503f90ed8f2a32d2ce9dda2d583391

I can't find the'/ var' directory when I run the ls command on Heroku.

$heroku run ls
 ›Warning: heroku update available from 7.46.2 to 7.47.0.
Running ls on ⬢ takkyurensyukai-bbb ... up, run.1884 (Free)
app config Gemfile log postcss.config.js Rakefile test yarn.lock
babel.config.js config.ru Gemfile.lock node_modules Procfile README.md tmp
bin db lib package.json public storage vendor