sqliteからmysqlへ変更し、その後rails :db:createコマンドを実行しデータベースの作成を試みたところ次のようなエラーが出てしまいました。
rails db:create
/Users/apple/.rbenv/versions/2.5.1/lib/ruby/2.5.0/fileutils.rb:90: warning: already initialized constant FileUtils::VERSION
/Users/apple/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/fileutils-1.4.1/lib/fileutils.rb:105: warning: previous definition of VERSION was here
/Users/apple/.rbenv/versions/2.5.1/lib/ruby/2.5.0/fileutils.rb:1188: warning: already initialized constant FileUtils::Entry_::S_IF_DOOR
/Users/apple/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/fileutils-1.4.1/lib/fileutils.rb:1284: warning: previous definition of S_IF_DOOR was here
/Users/apple/.rbenv/versions/2.5.1/lib/ruby/2.5.0/fileutils.rb:1446: warning: already initialized constant FileUtils::Entry_::DIRECTORY_TERM
/Users/apple/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/fileutils-1.4.1/lib/fileutils.rb:1568: warning: previous definition of DIRECTORY_TERM was here
/Users/apple/.rbenv/versions/2.5.1/lib/ruby/2.5.0/fileutils.rb:1501: warning: already initialized constant FileUtils::OPT_TABLE
/Users/apple/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/fileutils-1.4.1/lib/fileutils.rb:1626: warning: previous definition of OPT_TABLE was here
/Users/apple/.rbenv/versions/2.5.1/lib/ruby/2.5.0/fileutils.rb:1555: warning: already initialized constant FileUtils::LOW_METHODS
/Users/apple/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/fileutils-1.4.1/lib/fileutils.rb:1685: warning: previous definition of LOW_METHODS was here
/Users/apple/.rbenv/versions/2.5.1/lib/ruby/2.5.0/fileutils.rb:1562: warning: already initialized constant FileUtils::METHODS
/Users/apple/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/fileutils-1.4.1/lib/fileutils.rb:1692: warning: previous definition of METHODS was here
rails aborted!
ActiveRecord::DatabaseConfigurations::InvalidConfigurationError: '{ default => }' is not a valid configuration. Expected '' to be a URL string or a Hash.
/Users/apple/create/portfolio/Rakefile:6:in `<top (required)>'
/Users/apple/create/portfolio/bin/rails:9:in `<top (required)>'
/Users/apple/create/portfolio/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Caused by:
Bootsnap::LoadPathCache::FallbackScan:
(See full trace by running task with --trace)
また、sqliteからmysqlへ変更した際にdatabase.ymlも変更したのでそちらも載せておきます。
default: &default
adapter: mysql2
encoding: utf8
pool: 5
username: root
password: password #<- mysqlインストール時に設定したパスワード 例: 1
socket: /var/lib/mysql/mysql.sock
development:
<<: *default
database: アプリ名_development #アプリ名_development
test:
<<: *default
database: アプリ名_test #アプリ名_test
production:
<<: *default
database: アプリ名_production #アプリ名_production
username: アプリ名 #アプリ名
password: <%= ENV['TESTMYSQL_DATABASE_PASSWORD'] %>