Can't connect to local MySQL server through socket'/var/lib/mysql/mysql.sock' (2) until resolution.

Cause:

Because Mysql of heloku and the database used for deployment were not linked.

What I confirmed

heroku info

After execution, check the environment variables of the database

CLEARDB_DATABASE_URL:     mysql://xxxxxxxxxxxx
CLEARDB_DATABASE_GREEN:   mysql://xxxxxxxxxxxx
LANG:                     en_US.UTF-8
RACK_ENV:                 production
RAILS_ENV:                production
RAILS_LOG_TO_STDOUT:      enabled
RAILS_SERVE_STATIC_FILES: enabled
SECRET_KEY_BASE:

There should be DATABASE_URL: No, and I should have created a database with mysql2, but it is not reflected ...

Conclusion:

This is in the terminal

heroku config:set DATABASE_URL=mysql2${heroku_cleardb:5}

Because there was no input and the environment variables could not be stored in the mysql2 database.

Finally:

To change the environment variables, go to the heroku HP app page and click settings.

Click Reveal Config Vars in the center of the screen. Edit Config Vars and exit.

Safe,

heroku run rake db:migrate

it is complete!

Recommended Posts

Can't connect to local MySQL server through socket'/var/lib/mysql/mysql.sock' (2) until resolution.
Can't connect to local MySQL server through socket'/tmp/mysql.sock' (2) error
Can't connect to local MySQL server through socket'/tmp/mysql.sock' (2) error remedy
docker + mysql can't connect / Can't connect to local MySQL server through socket'var / run / mysqld / mysqld.sock' (2)
ERROR 2002 (HY000) when starting MySQL: Can't connect to local MySQL server through socket'/tmp/mysql.sock' (2)
[Java] Connect to MySQL
[Java] [SQL Server] Connect to local SQL Server 2017 using JDBC for SQL Server
To connect from Spring to MySQL on virtual server (unsolved)
Connect to MySQL 8 with Java
[Android] Connect to MySQL (unfinished)
Connect to Rails server with iPhone
Connect from Java to MySQL using Eclipse