0
0

More than 3 years have passed since last update.

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)エラーの解決方法

Posted at

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

capistranoでのデプロイ時に

Caused by:
SSHKit::Command::Failed: rake exit status: 1
rake stdout: Nothing written
rake stderr: rake aborted!
Mysql2::Error::ConnectionError: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

上記のエラーが出た。

MySQLサーバーと接続するタイミングで接続ができなくエラーが出た模様。

解決策としてはMySQLサーバーを再起動させることにより解決できる場合が多い。

EC2コンソール
$ sudo systemctl restart mysqld.service

上記のコマンドでMySQLサーバーを再起動させてから

ローカル
$ bundle exec cap production deploy

capistranoで自動デプロイできるようになる

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0