困っている事
bundle exec rake db:create
でエラーになってしまい、調べていますが、原因や解決法が分からず詰まっています。
MySQLには接続できています。
(この直前に、homebrewで入れたmysql5.6を削除して、5.7をインストールしました。)
その他の情報を以下に記載しております。
何か少しでもお分かりの方いましたら、教えて頂けますと大変助かります。
よろしくお願い致します。
エラー内容
testuserMacBook:myapp tesuser$ bundle exec rake db:create Mysql2::Error: Can't create database 'myapp_development' (errno: 2): CREATE DATABASE `myapp_development` DEFAULT CHARACTER SET `utf8` Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "reconnect"=>false, "pool"=>5, "username"=>"root", "password"=>"password9999", "host"=>"localhost", "timeout"=>5000, "variables"=>{"sql_mode"=>"TRADITIONAL"}, "database"=>"myapp_development"} rake aborted! ActiveRecord::StatementInvalid: Mysql2::Error: Can't create database 'myapp_development' (errno: 2): CREATE DATABASE `myapp_development` DEFAULT CHARACTER SET `utf8` /Users/testuser/.rbenv/versions/2.5.3/bin/bundle:23:in `load' /Users/testuser/.rbenv/versions/2.5.3/bin/bundle:23:in `<main>' Caused by: Mysql2::Error: Can't create database 'myapp_development' (errno: 2) /Users/testuser/.rbenv/versions/2.5.3/bin/bundle:23:in `load' /Users/testuser/.rbenv/versions/2.5.3/bin/bundle:23:in `<main>' Tasks: TOP => db:create
database.yml
default: &default adapter: mysql2 encoding: utf8 reconnect: false pool: 5 username: root password: password9999 host: localhost timeout: 5000 variables: sql_mode: TRADITIONAL development: <<: *default database: myapp_development
MySQLには接続できる
testuserMacBook:myapp tesuser$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1277 Server version: 5.6.47 Homebrew Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
MySQLのバージョン
testuserMacBook:myapp tesuser$ mysql --version mysql Ver 14.14 Distrib 5.7.32, for osx10.15 (x86_64) using EditLine wrapper
Railsのバージョン
testuserMacBook:myapp tesuser$ bundle exec rails -v Rails 5.0.7.2
回答1件
あなたの回答
tips
プレビュー