1
我是MySQL和Rails的新手。我正在經歷一個關於Lynda(Ruby on Rails 5)的課程,我遇到了一個呃逆。創建數據庫後,讓我啓動MySQL和Puma。我試圖訪問本地主機:3000,但是我得到以下錯誤:MySQL/Rails的 - Mysql2 ::錯誤(訪問被拒絕的用戶'rails_user'@'localhost'數據庫'simple_cms_development'):
Mysql2::Error (Access denied for user 'rails_user'@'localhost' to database 'simple_cms_development'):
看起來一切正常,MySQL和彪馬開始:
Johns-MBP:simple_cms johnerickson$ mysql.server start
Starting MySQL
SUCCESS!
Johns-MBP:simple_cms johnerickson$ rails s
=> Booting Puma
=> Rails 5.0.0.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.6.0 (ruby 2.3.0-p0), codename: Sleepy Sunday Serenity
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
* List item
下面是我的database.yml文件:
default: &default
adapter: mysql2
encoding: utf8
pool: 5
username: rails_user
password: ***The password works***
host: localhost
development:
<<: *default
database: simple_cms_development
我通過堆棧溢出望去,看到別人有過類似的問題,但它似乎是一個密碼問題,這我沒有。任何幫助將不勝感激。
謝謝Aruna。我做了類似於上面列出的代碼的東西,減去了'flush privileges'。我從一開始就開始製作視頻系列,然後開始工作。不完全確定我做了什麼不同,但我非常感謝您的反饋。它走了很長的路,所以我感謝你! – HeresJohnny5