前提・実現したいこと
前提
Ruby on Rails6にてアプリを作成
aws amazon amazon linux2にてデプロイ作業中
実現したいこと
本番環境でrailsを起動させたい
発生している問題・エラーメッセージ
ターミナル [ec2-user@ip-172-31-41-71 Dr_nishi]$ less log/unicorn.stderr.log I, [2020-11-28T04:27:13.668451 #27673] INFO -- : Refreshing Gem list I, [2020-11-28T04:27:15.839359 #27673] INFO -- : listening on addr=0.0.0.0:3000 fd=11 E, [2020-11-28T04:27:15.905289 #27673] ERROR -- : Access denied for user 'root'@'localhost' (using password: YES) (Mysql2::Error)
該当するソースコード
database.yml # 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: mysql2 encoding: utf8 pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> username: root password: kenichi1203 socket: /tmp/mysql.sock development: <<: *default database: Dr_nishi_development test: <<: *default database: Dr_nishi_test production: <<: *default database: Dr_nishi_production username: root password: Kenichi@1203 socket: /var/lib/mysql/mysql.sock
ローカル環境 my sql *******@********noMacBook-Pro Dr_nishi % mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.6.50 Homebrew Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
本番環境 my sql [ec2-user@*********** Dr_nishi]$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 10 Server version: 5.7.32 MySQL Community Server (GPL) Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
試したこと(仮説)
ERROR -- : Access denied for user 'root'@'localhost' (using password: YES) (Mysql2::Error)
エラー内容で検索をしました。
.my sql のパスワードを変更
.database.yml の記述を変更
試しましたが変化はありませんでした。
補足
初心者で言葉足らずで申し訳ありませんがご教示頂けたらと思い質問させて頂きました。
宜しくお願い致します。
補足2
database.yml default: #&default adapter: mysql2 encoding: utf8 pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> username: root password: kenichi1203 socket: /tmp/mysql.sock development: #<<: *default database: Dr_nishi_development test: #<<: *default database: Dr_nishi_test production: #<<: *default database: Dr_nishi_production username: root password: Kenichi@1203 socket: /var/lib/mysql/mysql.sock
あなたの回答
tips
プレビュー