#前回の続き
時間がだいぶ経ちましたが前回の記事の続きについて記載していきます。
#環境
・macOS BigSur 11.6
・Ruby 2.5.3
・Rails 5.2.6
・Homebrew 3.2.16
#MYSQLのインストール
$ brew install mysql
PASSを通す
$ echo 'export PATH="/usr/local/opt/mysql/bin:$PATH"' >> ~/.zshrc
設定を反映
$ source ~/.zshrc
MYSQLの起動、接続確認
$ brew services start mysql
%$mysql -uroot
#mimemagicのライセンス更新
$ bundle install
エラー発生
An error occurred while installing mimemagic (0.3.10), and Bundler cannot continue.
Make sure that `gem install mimemagic -v '0.3.10' --source 'https://rubygems.org/'` succeeds before bundling.
新しいライセンスのmimemagicをインストール
$ brew install shared-mime-info
再度
$ bundle install
成功
Bundle complete! 18 Gemfile dependencies, 73 gems now installed.
Gems in the group production were not installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
#MY SQLの設定変更
サーバー起動
$ rails s
MYSQLあたりでエラー発生
エラーが発生したファイルがあるか確認
どうやらrailsのconfig/database.yml
の設定がおかしいようなので、設定を変更
username、password、socketの修正
username: root
password:
socket: /tmp/mysql.sock
#アプリ起動
$ rails s
エラー発生。データベースを作成していなかった。。。
$ rails db:create
$ rails db:migrate
$ rails s
localhost:3000
に接続すると、無事にアプリを起動できました!
いろいろな方の知見をお借りしてなんとかできました。
間違い等あればご指導、ご鞭撻のほどよろしくお願いします。
まだまだ勉強が必要ですね。
#参考
https://qiita.com/tkmd35/items/c26d1dffca4be0a4f017
https://qiita.com/koki0527/items/5eb8d8c1ac56dcd05466