MySQLをインストールし、"rails db:create"でデータベースを作成しようとしたところ、以下のエラーが発生しました。
エラー文を検索してみたのですが、あまり有力なものが見つからず困っています。
どなたかヒントでもよろしいのでご教示いただけますでしょうか。
環境は以下になっています。
windows
WSL ubuntu
ruby
ruby on rails
mysql
MySQL
1/home/olivemochi/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-6.0.2.2/lib/rails/app_loader.rb:53: warning: Insecure world writable dir /home/olivemochi/.rbenv/versions/2.5.1 in PATH, mode 040777 2Mysql2::Error::ConnectionError: Access denied for user 'olivemochi'@'localhost' to database 'testapp_development' 3Couldn't create 'testapp_development' database. Please check your configuration. 4rails aborted! 5ActiveRecord::StatementInvalid: Mysql2::Error::ConnectionError: Access denied for user 'olivemochi'@'localhost' to database 'testapp_development' 6/home/olivemochi/testapp/bin/rails:9:in `<top (required)>' 7/home/olivemochi/testapp/bin/spring:15:in `<top (required)>' 8bin/rails:3:in `load' 9bin/rails:3:in `<main>' 10 11Caused by: 12Mysql2::Error::ConnectionError: Access denied for user 'olivemochi'@'localhost' to database 'testapp_development' 13/home/olivemochi/testapp/bin/rails:9:in `<top (required)>' 14/home/olivemochi/testapp/bin/spring:15:in `<top (required)>' 15bin/rails:3:in `load' 16bin/rails:3:in `<main>' 17Tasks: TOP => db:create 18(See full trace by running task with --trace)
以下はconfig/database.ymlの中身です。
yml
1# MySQL. Versions 5.5.8 and up are supported. 2# 3# Install the MySQL driver 4# gem install mysql2 5# 6# Ensure the MySQL gem is defined in your Gemfile 7# gem 'mysql2' 8# 9# And be sure to use new-style password hashing: 10# https://dev.mysql.com/doc/refman/5.7/en/password-hashing.html 11# 12default: &default 13 adapter: mysql2 14 encoding: utf8mb4 15 pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 16 username: olivemochi 17 password: "伏字にしておきます" 18 socket: /var/run/mysqld/mysqld.sock 19 20development: 21 <<: *default 22 database: testapp_development 23 24# Warning: The database defined as "test" will be erased and 25# re-generated from your development database when you run "rake". 26# Do not set this db to the same as development or production. 27test: 28 <<: *default 29 database: testapp_test 30 31# As with config/credentials.yml, you never want to store sensitive information, 32# like your database password, in your source code. If your source code is 33# ever seen by anyone, they now have access to your database. 34# 35# Instead, provide the password as a unix environment variable when you boot 36# the app. Read https://guides.rubyonrails.org/configuring.html#configuring-a-database 37# for a full rundown on how to provide these environment variables in a 38# production deployment. 39# 40# On Heroku and other platform providers, you may have a full connection URL 41# available as an environment variable. For example: 42# 43# DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase" 44# 45# You can use this database configuration with: 46# 47# production: 48# url: <%= ENV['DATABASE_URL'] %> 49# 50production: 51 <<: *default 52 database: testapp_production 53 username: testapp 54 password: <%= ENV['TESTAPP_DATABASE_PASSWORD'] %>
回答1件
あなたの回答
tips
プレビュー