質問編集履歴

1

質問を根本的な方に変えた

2020/11/26 14:11

投稿

1234s
1234s

スコア1

test CHANGED
File without changes
test CHANGED
@@ -1,191 +1,11 @@
1
- HerokuではPostgreSQLを使用するたPostgreSQLのデータベースを作ろうとしたら
1
+ Herokuのプラットフォームにデプロイする際HerokuではPostgreSQLを使用するとのことでしので rails _6.0.0_ new cooking-recip -d PostgreSQL
2
2
 
3
- 以下のようなエラーが出てまいます
3
+ でアプリを作りまた。
4
4
 
5
- ### ミナル
5
+ そしてrails db:createをするとエラが起きてしまい色々なサイトを参考にしてみたのですが上手くいかず、訳が解らない状態になってしまいました。
6
6
 
7
- hasegawaakiranari@hasegawaakiranarinoMacBook-Pro cooking-recip % rails db:create
8
-
9
- FATAL: password authentication failed for user "ここにはvscode で定義したusernameが入ってます"
10
-
11
- Couldn't create 'cooking_recip_development' database. Please check your configuration.
12
-
13
- rails aborted!
14
-
15
- PG::ConnectionBad: FATAL: password authentication failed for user "ここにはvscode で定義したusernameが入ってます"
16
-
17
- /Users/hasegawaakiranari/projects/cooking-recip/bin/rails:9:in `<top (required)>'
18
-
19
- /Users/hasegawaakiranari/projects/cooking-recip/bin/spring:15:in `<top (required)>'
7
+ そこで質問なのですがPostgreSQLでデータベースを作る際HerokuのPostgreSQLのデータベースを使うのか、それともherokuじゃないPostgreSQLのデータベースを使ってアプリを作ってherokuにデプロイする時に接続するのでしょうか?
20
-
21
- bin/rails:3:in `load'
22
-
23
- bin/rails:3:in `<main>'
24
-
25
- Tasks: TOP => db:create
26
-
27
- (See full trace by running task with --trace)
28
8
 
29
9
 
30
10
 
31
- パスワードや名前などはherokuのこのページの部分のやつを入れました
32
-
33
- ![イメージ説明](19e4c7b1b26e8c7be73a195711505b12.png)
34
-
35
-
36
-
37
- vscodo
38
-
39
- ```default: &default
40
-
41
- adapter: postgresql
42
-
43
- encoding: utf8
44
-
45
- username: herokuのuserの部分を入れてます
46
-
47
- password: herokuのpasswordの部分を入れてます
48
-
49
- pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
50
-
51
- host: localhost
52
-
53
- timeout: 5000
54
-
55
- development:
56
-
57
- <<: *default
58
-
59
- database: cooking_recip_development
60
-
61
- template: template0
62
-
63
- # The specified database role being used to connect to postgres.
64
-
65
- # To create additional roles in postgres see `$ createuser --help`.
66
-
67
- # When left blank, postgres will use the default role. This is
68
-
69
- # the same name as the operating system user that initialized the database.
70
-
71
- #username: cooking_recip
72
-
73
-
74
-
75
- # The password associated with the postgres role (username).
76
-
77
- #password:
78
-
79
-
80
-
81
- # Connect on a TCP socket. Omitted by default since the client uses a
82
-
83
- # domain socket that doesn't need configuration. Windows does not have
84
-
85
- # domain sockets, so uncomment these lines.
86
-
87
- #host: localhost
88
-
89
-
90
-
91
- # The TCP port the server listens on. Defaults to 5432.
92
-
93
- # If your server runs on a different port number, change accordingly.
94
-
95
- #port: 5432
96
-
97
-
98
-
99
- # Schema search path. The server defaults to $user,public
100
-
101
- #schema_search_path: myapp,sharedapp,public
102
-
103
-
104
-
105
- # Minimum log levels, in increasing order:
106
-
107
- # debug5, debug4, debug3, debug2, debug1,
108
-
109
- # log, notice, warning, error, fatal, and panic
110
-
111
- # Defaults to warning.
11
+ 初歩的な質問なのですが回答の方お願いします。
112
-
113
- #min_messages: notice
114
-
115
-
116
-
117
- # Warning: The database defined as "test" will be erased and
118
-
119
- # re-generated from your development database when you run "rake".
120
-
121
- # Do not set this db to the same as development or production.
122
-
123
- test:
124
-
125
- <<: *default
126
-
127
- database: cooking_recip_test
128
-
129
- encoding: utf-8
130
-
131
-
132
-
133
- # As with config/credentials.yml, you never want to store sensitive information,
134
-
135
- # like your database password, in your source code. If your source code is
136
-
137
- # ever seen by anyone, they now have access to your database.
138
-
139
- #
140
-
141
- # Instead, provide the password as a unix environment variable when you boot
142
-
143
- # the app. Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
144
-
145
- # for a full rundown on how to provide these environment variables in a
146
-
147
- # production deployment.
148
-
149
- #
150
-
151
- # On Heroku and other platform providers, you may have a full connection URL
152
-
153
- # available as an environment variable. For example:
154
-
155
- #
156
-
157
- # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
158
-
159
- #
160
-
161
- # You can use this database configuration with:
162
-
163
- #
164
-
165
- # production:
166
-
167
- # url: <%= ENV['DATABASE_URL'] %>
168
-
169
- #
170
-
171
- production:
172
-
173
- <<: *default
174
-
175
- database: cooking_recip_production
176
-
177
- # username: cooking_recip
178
-
179
- # password: <%= ENV['COOKING_RECIP_DATABASE_PASSWORD'] %>
180
-
181
- コード
182
-
183
- ```
184
-
185
-
186
-
187
- 作業する時に参考にしたページのurl
188
-
189
- https://k-sasaking.net/programing/heroku-postgres-install/
190
-
191
- https://teratail.com/questions/186265?link=qa_related_pc