2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

rails触りながらハマったときの解決メモ

Last updated at Posted at 2018-07-05

rails s → だめです

権限を確認する

sudo chmod -R 777 /usr/local/var/mysql/

bundle install "rmagick" でインストールができない - Qiita

mysqlが起動できない - Qiita

流れ

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (

Step1

エラーログを
(2) → (38)
に変えて

step 2

mysqlが突然起動しなくなる 第二幕 - 猫も杓子も記事を書く

/tmp/mysql.sock.lock
を消す

mysql 再起動

$ sudo mysql.server restart

なんか変なときのDB再起動など

# データベースのやりなおし
$ bundle exec rake db:drop
$ bundle exec rake db:create
$ bundle exec rake db:migrate

# 種をまく
$ bundle exec rake db:seed:user
$ bundle exec rake db:seed:kessan

rails s で立たない

rails s

...
...
...
Address already in use - bind(2) for "0.0.0.0" port 3000 (Errno::EADDRINUSE)

###解決策

使われてるポートを頑張って消します


ps aux | grep puma
*****             692   0.0  0.3  2566352  28056   ??  S    10:40AM   0:00.38 puma 3.12.0 (tcp://0.0.0.0:3000) [******]  
↑こいつが原因なので

sudo kill -9 692(ポート番号)

ちゃんと消えてるか確認
ps aux | grep puma

参考
http://hyottokoaloha.hatenablog.com/entry/2015/09/17/144100

rbenv

rbenv: bundle: command not found の解決

本番環境→テスト環境切り替え

database.yml
username: root
password:

development:
  <<: *default
  database: *****_development
puma.rb
environment ENV.fetch("RAILS_ENV") { "development" }

#homeディレクトリの設定とかしてたらそこも変更
2
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
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?