質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

3回答

7080閲覧

rake db:create をした際にこのようなエラーが出ます。このエラーはなんでしょうか?

AbeRyuki

総合スコア11

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2016/05/16 04:51

rake db:create をした際にこのようなエラーが出ます。このエラーはなんでしょうか?

aberyuuryoku-no-MacBook-Air:butelr ryuki$ rake db:create
#<Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)>
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "pool"=>5, "username"=>"root", "password"=>nil, "host"=>"localhost", "database"=>"butelr_development"}, {:charset=>"utf8", :collation=>"utf8_unicode_ci"}
(If you set the charset manually, make sure you have a matching collation)
#<Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)>
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "pool"=>5, "username"=>"root", "password"=>nil, "host"=>"localhost", "database"=>"butelr_test"}, {:charset=>"utf8", :collation=>"utf8_unicode_ci"}
(If you set the charset manually, make sure you have a matching collation)

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答3

0

接続に失敗しているようですね、database.ymlの内容を確認してみてください。
"password"=>nil となっていますが、MySQLにパスワードは設定していないのでしょうか?

投稿2016/05/16 05:50

ShoheiUyama

総合スコア206

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

AbeRyuki

2016/05/16 06:02

yml はこんな感じです???? default: &default adapter: mysql2 encoding: utf8 pool: 5 username: root password: socket: /tmp/mysql.sock development: <<: *default database: butelr_development # 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: <<: *default database: butelr_test
AbeRyuki

2016/05/16 06:04

いろいろ試して今はこのようになりました。 aberyuuryoku-no-MacBook-Air:butelr ryuki$ rake db:cereate rake aborted! Don't know how to build task 'db:cereate' (see --tasks) (See full trace by running task with --trace)
ShoheiUyama

2016/05/16 06:10

db:create と言うタスクがないというエラーになっていますね、コマンドを実行する場所は正しいですか?
guest

0

mysql起動させましょう、起動確認後にdatabase.yml眺めてみましょう。username, password, database間違っていないか。

投稿2016/05/16 05:12

KeitaSuzuki

総合スコア15

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

AbeRyuki

2016/05/16 05:55

brew install mysql→ mysql.server start この手順で起動でまちがいないでしょうか? エラーが出ます????    aberyuuryoku-no-MacBook-Air:butelr ryuki$ brew install mysql ==> Installing dependencies for mysql: openssl ==> Installing mysql dependency: openssl ==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2h_1.el_capitan ######################################################################## 100.0% ==> Pouring openssl-1.0.2h_1.el_capitan.bottle.tar.gz ==> Caveats A CA file has been bootstrapped using certificates from the system keychain. To add additional certificates, place .pem files in /usr/local/etc/openssl/certs and run /usr/local/opt/openssl/bin/c_rehash This formula is keg-only, which means it was not symlinked into /usr/local. Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries Generally there are no consequences of this for you. If you build your own software and it requires this formula, you'll need to add to your build variables: LDFLAGS: -L/usr/local/opt/openssl/lib CPPFLAGS: -I/usr/local/opt/openssl/include ==> Summary ???? /usr/local/Cellar/openssl/1.0.2h_1: 1,691 files, 12M ==> Installing mysql ==> Downloading https://homebrew.bintray.com/bottles/mysql-5.7.12.el_capitan.bot ######################################################################## 100.0% ==> Pouring mysql-5.7.12.el_capitan.bottle.tar.gz aberyuuryoku-no-MacBook-Air:butelr ryuki$ mysql.server start   Starting MySQL ..................................................................................................... ERROR! The server quit withoutupdating PID file (/usr/local/var/mysql/aberyuuryoku-no-MacBook-Air.local.pid).
AbeRyuki

2016/05/16 06:04

ちなみにいろいろ試して今はこのようになりました。 aberyuuryoku-no-MacBook-Air:butelr ryuki$ rake db:cereate rake aborted! Don't know how to build task 'db:cereate' (see --tasks) (See full trace by running task with --trace)
guest

0

MySQLに繋がっていない状態です。接続設定を確認しましょう。

投稿2016/05/16 04:58

maisumakun

総合スコア145183

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

AbeRyuki

2016/05/16 06:06

ちなみにいろいろ試して今はこのようになりました。 aberyuuryoku-no-MacBook-Air:butelr ryuki$ rake db:cereate rake aborted! Don't know how to build task 'db:cereate' (see --tasks) (See full trace by running task with --trace)
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問