アプリの開発中にmysql2をインストールし、database.ymlを修正し
development: adapter: mysql2 encoding: utf8 database: portfolio_development pool: 5 username: root password: パスワード # socket: /var/run/mysqld/mysqld.sock # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: adapter: mysql2 encoding: utf8 database: portfolio_test pool: 5 username: root password: パスワード # socket: /var/run/mysqld/mysqld.sock production: adapter: mysql2 encoding: utf8 database: portfolio_production pool: 5 username: root password: パスワード # socket: /var/run/mysqld/mysqld.sock
このように修正しました。この変更を行った後、db:createコマンドを実行した結果、、
rails db:create Mysql2::Error: Can't create database 'portfolio_development' (errno: 13) Couldn't create 'portfolio_development' database. Please check your configuration. rails aborted! ActiveRecord::StatementInvalid: Mysql2::Error: Can't create database 'portfolio_development' (errno: 13) /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: Mysql2::Error: Can't create database 'portfolio_development' (errno: 13) /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>' Tasks: TOP => db:create (See full trace by running task with --trace)
とこのようなエラー文が表示されてしまい、ベータベースを作ることができません。アプリ名はportfolioとしてあります。また、パスワードは設定したものを入力してあります。
質問の確認と返信をよろしくお願いします!
前回もこれと似たエラー質問を投稿しましたが、まだ解決には至っていないのでよろしくお願いします!バージョン等は下記に表示しておきます!
mysql Ver 14.14 Distrib 5.6.47, for osx10.15 (x86_64) using EditLine wrapper
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin15]
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/06/21 13:41