0
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 3 years have passed since last update.

Access denied for user 'root'@'localhost'と出た場合の対処法

Posted at

rails sでブラウザを開いたときにエラーが発生。


・エラー内容 ![2d42fad8fec8caa6dc24815ac636c909.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/1962714/47240b6a-39bb-da8e-68d4-d721bb82a49d.png)
・原因 MySQL接続時のユーザーをきちんと指定できてない
・解決策 以下のように自分の環境におけるパスワードを設定します。

/config/database.yml

default: &default
  username: dbuser
  password: dbpass

非常に簡潔な内容でしたが以上でOKです。


開発環境
mac OS バージョン11.6

Rails 6.1.4.4
Ruby 3.0.0
MYSQL 0.5

エディタ
Cloud9

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?