teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

データベースの設定について追記

2021/09/02 08:20

投稿

hase744
hase744

スコア57

title CHANGED
File without changes
body CHANGED
@@ -33,12 +33,36 @@
33
33
 
34
34
  データベスの設定は以下の通りです
35
35
  ```yml
36
+ # SQLite. Versions 3.8.0 and up are supported.
37
+ # gem install sqlite3
38
+ #
39
+ # Ensure the SQLite 3 gem is defined in your Gemfile
40
+ # gem 'sqlite3'
41
+ #
42
+ default: &default
43
+ adapter: sqlite3
44
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
45
+ timeout: 5000
46
+
47
+ development:
48
+ <<: *default
49
+ database: db/development.sqlite3
50
+
51
+ # Warning: The database defined as "test" will be erased and
52
+ # re-generated from your development database when you run "rake".
53
+ # Do not set this db to the same as development or production.
54
+ test:
55
+ <<: *default
56
+ database: db/test.sqlite3
57
+
36
58
  production:
37
59
  <<: *default
60
+ #database: db/production.sqlite3
38
61
  database: <%= Rails.application.credentials.db[:database] %>
39
62
  username: <%= Rails.application.credentials.db[:username] %>
40
63
  password: <%= Rails.application.credentials.db[:password] %>
41
64
  socket: <%= Rails.application.credentials.db[:socket] %>
65
+
42
66
  ```
43
67
  ```yml
44
68
  db:

1

データベースの設定について追記

2021/09/02 08:20

投稿

hase744
hase744

スコア57

title CHANGED
File without changes
body CHANGED
@@ -29,4 +29,34 @@
29
29
  MariaDB [(none)]> USE ec_site;
30
30
  ERROR 1049 (42000): Unknown database 'ec_site'
31
31
 
32
- ```
32
+ ```
33
+
34
+ データベスの設定は以下の通りです
35
+ ```yml
36
+ production:
37
+ <<: *default
38
+ database: <%= Rails.application.credentials.db[:database] %>
39
+ username: <%= Rails.application.credentials.db[:username] %>
40
+ password: <%= Rails.application.credentials.db[:password] %>
41
+ socket: <%= Rails.application.credentials.db[:socket] %>
42
+ ```
43
+ ```yml
44
+ db:
45
+ database: ec_site
46
+ username: root
47
+ password: xxxxxx
48
+ socket: /var/lib/mysql/mysql.sock
49
+ ```
50
+
51
+
52
+ ちなみにsqliteにもデータベースはありませんでした。
53
+ ```command
54
+ [ec2-user@ip-10-0-0-235 ec_site]$ sqlite3
55
+ SQLite version 3.7.17 2013-05-20 00:56:22
56
+ Enter ".help" for instructions
57
+ Enter SQL statements terminated with a ";"
58
+ sqlite> .tables
59
+ sqlite>
60
+ ```
61
+
62
+ サーバーは一台しか作ってないはずです