質問編集履歴

1

書式の改善

2016/05/16 12:43

投稿

AbeRyuki
AbeRyuki

スコア11

test CHANGED
@@ -1 +1 @@
1
- rake db:create のエラー
1
+ rake db:create のエラー データベース作成中ですがうまく動きません。
test CHANGED
@@ -2,12 +2,142 @@
2
2
 
3
3
 
4
4
 
5
- aberyuuryoku-no-MacBook-Air:butelr ryuki$ rake db:ceate
5
+ データベースを作成したいのですがエラーが出てしまいます。
6
6
 
7
- rake aborted!
7
+ 多分socketの問題だとは思うのですが。
8
-
9
- Don't know how to build task 'db:ceate' (see --tasks)
10
8
 
11
9
 
12
10
 
13
- (See full trace by running task with --trace)
11
+
12
+
13
+ aberyuuryoku-no-MacBook-Air:pictweet ryuki$ rake db:create
14
+
15
+ #<Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)>
16
+
17
+ Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "pool"=>5, "username"=>"root", "password"=>nil, "socket"=>"/tmp/mysql.sock", "database"=>"pictweet_development"}, {:charset=>"utf8", :collation=>"utf8_unicode_ci"}
18
+
19
+ (If you set the charset manually, make sure you have a matching collation)
20
+
21
+ #<Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)>
22
+
23
+ Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "pool"=>5, "username"=>"root", "password"=>nil, "socket"=>"/tmp/mysql.sock", "database"=>"pictweet_test"}, {:charset=>"utf8", :collation=>"utf8_unicode_ci"}
24
+
25
+ (If you set the charset manually, make sure you have a matching collation)
26
+
27
+
28
+
29
+
30
+
31
+ detabase.yml➡︎
32
+
33
+
34
+
35
+ # MySQL. Versions 5.0+ are recommended.
36
+
37
+ #
38
+
39
+ # Install the MYSQL driver
40
+
41
+ # gem install mysql2
42
+
43
+ #
44
+
45
+ # Ensure the MySQL gem is defined in your Gemfile
46
+
47
+ # gem 'mysql2'
48
+
49
+ #
50
+
51
+ # And be sure to use new-style password hashing:
52
+
53
+ # http://dev.mysql.com/doc/refman/5.0/en/old-client.html
54
+
55
+ #
56
+
57
+ default: &default
58
+
59
+ adapter: mysql2
60
+
61
+ encoding: utf8
62
+
63
+ pool: 5
64
+
65
+ username: root
66
+
67
+ password:
68
+
69
+ socket: /tmp/mysql.sock
70
+
71
+
72
+
73
+
74
+
75
+ development:
76
+
77
+ <<: *default
78
+
79
+ database: pictweet_development
80
+
81
+
82
+
83
+ # Warning: The database defined as "test" will be erased and
84
+
85
+ # re-generated from your development database when you run "rake".
86
+
87
+ # Do not set this db to the same as development or production.
88
+
89
+ test:
90
+
91
+ <<: *default
92
+
93
+ database: pictweet_test
94
+
95
+
96
+
97
+ # As with config/secrets.yml, you never want to store sensitive information,
98
+
99
+ # like your database password, in your source code. If your source code is
100
+
101
+ # ever seen by anyone, they now have access to your database.
102
+
103
+ #
104
+
105
+ # Instead, provide the password as a unix environment variable when you boot
106
+
107
+ # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
108
+
109
+ # for a full rundown on how to provide these environment variables in a
110
+
111
+ # production deployment.
112
+
113
+ #
114
+
115
+ # On Heroku and other platform providers, you may have a full connection URL
116
+
117
+ # available as an environment variable. For example:
118
+
119
+ #
120
+
121
+ # DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase"
122
+
123
+ #
124
+
125
+ # You can use this database configuration with:
126
+
127
+ #
128
+
129
+ # production:
130
+
131
+ # url: <%= ENV['DATABASE_URL'] %>
132
+
133
+ #
134
+
135
+ production:
136
+
137
+ <<: *default
138
+
139
+ database: pictweet_production
140
+
141
+ username: pictweet
142
+
143
+ password: <%= ENV['PICTWEET_DATABASE_PASSWORD'] %>