質問編集履歴
10
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
お世話になっております。
|
2
|
-
現在、LuggageMGTというアプリ
|
2
|
+
現在、LuggageMGTというアプリ作成しています。
|
3
3
|
|
4
4
|
勉強で、Docker環境でcircleCIを使用しております。
|
5
5
|
|
@@ -11,6 +11,8 @@
|
|
11
11
|
|
12
12
|
と出てしまいます。
|
13
13
|
|
14
|
+
|
15
|
+
|
14
16
|
#実行したこと
|
15
17
|
/tmp/mysql.sockが存在するか下記コマンドで確認しました
|
16
18
|
```
|
@@ -27,8 +29,14 @@
|
|
27
29
|
.. SUCCESS!
|
28
30
|
```
|
29
31
|
|
32
|
+
きちんとファイルは存在するのに、
|
33
|
+
```
|
34
|
+
(2 "No such file or directory")
|
35
|
+
```
|
36
|
+
と出る理由も分かりません。
|
30
37
|
|
31
38
|
|
39
|
+
|
32
40
|
下記に該当してそうなファイルを記述致します。
|
33
41
|
まだまだ知識が甘く、変なところもあるかもしれないです。よろしくお願い致します。
|
34
42
|
|
9
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -14,13 +14,17 @@
|
|
14
14
|
#実行したこと
|
15
15
|
/tmp/mysql.sockが存在するか下記コマンドで確認しました
|
16
16
|
```
|
17
|
-
%mysql_config --socket
|
17
|
+
% mysql_config --socket
|
18
18
|
/tmp/mysql.sock
|
19
19
|
```
|
20
20
|
|
21
21
|
下記コマンドでMySQLを再起動させました。
|
22
22
|
```
|
23
|
-
mysql.server restart
|
23
|
+
% mysql.server restart
|
24
|
+
Shutting down MySQL
|
25
|
+
.. SUCCESS!
|
26
|
+
Starting MySQL
|
27
|
+
.. SUCCESS!
|
24
28
|
```
|
25
29
|
|
26
30
|
|
8
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
下記コマンドでMySQLを再起動させました。
|
22
22
|
```
|
23
|
-
|
23
|
+
mysql.server restart
|
24
24
|
```
|
25
25
|
|
26
26
|
|
7
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -12,18 +12,19 @@
|
|
12
12
|
と出てしまいます。
|
13
13
|
|
14
14
|
#実行したこと
|
15
|
-
/tmp/mysql.sockが存在するか確認
|
15
|
+
/tmp/mysql.sockが存在するか下記コマンドで確認しました
|
16
16
|
```
|
17
|
-
mysql_config --socket
|
17
|
+
%mysql_config --socket
|
18
|
+
/tmp/mysql.sock
|
18
19
|
```
|
19
20
|
|
20
|
-
|
21
|
+
下記コマンドでMySQLを再起動させました。
|
21
22
|
```
|
22
23
|
sudo mysql.server start
|
23
24
|
```
|
24
|
-
でMySQLを再起動させました。
|
25
25
|
|
26
26
|
|
27
|
+
|
27
28
|
下記に該当してそうなファイルを記述致します。
|
28
29
|
まだまだ知識が甘く、変なところもあるかもしれないです。よろしくお願い致します。
|
29
30
|
|
6
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -18,7 +18,10 @@
|
|
18
18
|
```
|
19
19
|
|
20
20
|
を打ち、存在は確認できました。
|
21
|
+
```
|
21
|
-
|
22
|
+
sudo mysql.server start
|
23
|
+
```
|
24
|
+
でMySQLを再起動させました。
|
22
25
|
|
23
26
|
|
24
27
|
下記に該当してそうなファイルを記述致します。
|
5
修正
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
|
1
|
+
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2 "No such file or directorエラー
|
body
CHANGED
File without changes
|
4
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -4,53 +4,84 @@
|
|
4
4
|
勉強で、Docker環境でcircleCIを使用しております。
|
5
5
|
|
6
6
|
# 解決したいこと、エラー
|
7
|
-
|
7
|
+
ローカルのターミナルにて、docker-compose upをすると、
|
8
8
|
```
|
9
|
-
|
9
|
+
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2 "No such file or directory")
|
10
10
|
```
|
11
|
-
を打つと、
|
12
|
-
```
|
13
|
-
Unknown MySQL server host 'db' (25)
|
14
|
-
Couldn't create 'LuggageMGT_production' database. Please check your configuration.
|
15
|
-
rails aborted!
|
16
|
-
Mysql2::Error::ConnectionError: Unknown MySQL server host 'db' (25)
|
17
|
-
bin/rails:4:in `<main>'
|
18
|
-
Tasks: TOP => db:create
|
19
|
-
(See full trace by running task with --trace)
|
20
|
-
```
|
21
11
|
|
22
12
|
と出てしまいます。
|
23
13
|
|
24
14
|
#実行したこと
|
25
|
-
mysqlが
|
15
|
+
/tmp/mysql.sockが存在するか確認するため、
|
26
16
|
```
|
27
|
-
|
17
|
+
mysql_config --socket
|
28
18
|
```
|
29
19
|
|
20
|
+
を打ち、存在は確認できました。
|
30
|
-
|
21
|
+
しかし、なぜこの様なエラーが出るかが分かりません。
|
31
22
|
|
32
|
-
ローカルでは、
|
33
|
-
```
|
34
|
-
docker-compose run web rails db:create
|
35
|
-
docker-compose run web rails db:migrate
|
36
|
-
```
|
37
23
|
|
38
|
-
をし、テーダベースは作成できました。
|
39
|
-
(関係あるかは分かりませんが、docker-compose downをすると、upした後再度rails db:createからし直さなければいけない状況です。)
|
40
|
-
|
41
|
-
下記
|
24
|
+
下記に該当してそうなファイルを記述致します。
|
42
25
|
まだまだ知識が甘く、変なところもあるかもしれないです。よろしくお願い致します。
|
43
26
|
|
44
27
|
database.yml
|
45
28
|
```
|
29
|
+
# MySQL. Versions 5.1.10 and up are supported.
|
46
|
-
#
|
30
|
+
#
|
31
|
+
# Install the MySQL driver
|
32
|
+
# gem install mysql2
|
33
|
+
#
|
34
|
+
# Ensure the MySQL gem is defined in your Gemfile
|
35
|
+
# gem 'mysql2'
|
36
|
+
#
|
37
|
+
# And be sure to use new-style password hashing:
|
38
|
+
# https://dev.mysql.com/doc/refman/5.7/en/password-hashing.html
|
39
|
+
#
|
40
|
+
default: &default
|
41
|
+
adapter: mysql2
|
42
|
+
encoding: utf8
|
43
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
44
|
+
username: root
|
45
|
+
password: password
|
46
|
+
host: localhost
|
47
|
+
socket: /tmp/mysql.sock
|
47
48
|
|
49
|
+
development:
|
50
|
+
<<: *default
|
51
|
+
database: LuggageMGT_development
|
52
|
+
|
53
|
+
# Warning: The database defined as "test" will be erased and
|
54
|
+
# re-generated from your development database when you run "rake".
|
55
|
+
# Do not set this db to the same as development or production.
|
56
|
+
test:
|
57
|
+
<<: *default
|
58
|
+
database: LuggageMGT_test
|
59
|
+
|
60
|
+
# As with config/secrets.yml, you never want to store sensitive information,
|
61
|
+
# like your database password, in your source code. If your source code is
|
62
|
+
# ever seen by anyone, they now have access to your database.
|
63
|
+
#
|
64
|
+
# Instead, provide the password as a unix environment variable when you boot
|
65
|
+
# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
|
66
|
+
# for a full rundown on how to provide these environment variables in a
|
67
|
+
# production deployment.
|
68
|
+
#
|
69
|
+
# On Heroku and other platform providers, you may have a full connection URL
|
70
|
+
# available as an environment variable. For example:
|
71
|
+
#
|
72
|
+
# DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase"
|
73
|
+
#
|
74
|
+
# You can use this database configuration with:
|
75
|
+
#
|
76
|
+
# production:
|
77
|
+
# url: <%= ENV['DATABASE_URL'] %>
|
78
|
+
#
|
48
79
|
production:
|
49
80
|
<<: *default
|
50
81
|
database: LuggageMGT_production
|
51
82
|
username: root
|
52
83
|
password: <%= ENV['DATABASE_PASSWORD'] %>
|
53
|
-
socket: /
|
84
|
+
socket: /tmp/mysql.sock
|
54
85
|
```
|
55
86
|
docker-compose.yml
|
56
87
|
```
|
3
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -125,4 +125,67 @@
|
|
125
125
|
command: bundle -v
|
126
126
|
- ruby/bundle-install
|
127
127
|
|
128
|
-
```
|
128
|
+
```
|
129
|
+
|
130
|
+
追記です。
|
131
|
+
database.ymlです。
|
132
|
+
```
|
133
|
+
# MySQL. Versions 5.1.10 and up are supported.
|
134
|
+
#
|
135
|
+
# Install the MySQL driver
|
136
|
+
# gem install mysql2
|
137
|
+
#
|
138
|
+
# Ensure the MySQL gem is defined in your Gemfile
|
139
|
+
# gem 'mysql2'
|
140
|
+
#
|
141
|
+
# And be sure to use new-style password hashing:
|
142
|
+
# https://dev.mysql.com/doc/refman/5.7/en/password-hashing.html
|
143
|
+
#
|
144
|
+
default: &default
|
145
|
+
adapter: mysql2
|
146
|
+
encoding: utf8
|
147
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
148
|
+
username: root
|
149
|
+
password: password
|
150
|
+
host: localhost
|
151
|
+
|
152
|
+
development:
|
153
|
+
<<: *default
|
154
|
+
database: LuggageMGT_development
|
155
|
+
|
156
|
+
# Warning: The database defined as "test" will be erased and
|
157
|
+
# re-generated from your development database when you run "rake".
|
158
|
+
# Do not set this db to the same as development or production.
|
159
|
+
test:
|
160
|
+
<<: *default
|
161
|
+
database: LuggageMGT_test
|
162
|
+
|
163
|
+
# As with config/secrets.yml, you never want to store sensitive information,
|
164
|
+
# like your database password, in your source code. If your source code is
|
165
|
+
# ever seen by anyone, they now have access to your database.
|
166
|
+
#
|
167
|
+
# Instead, provide the password as a unix environment variable when you boot
|
168
|
+
# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
|
169
|
+
# for a full rundown on how to provide these environment variables in a
|
170
|
+
# production deployment.
|
171
|
+
#
|
172
|
+
# On Heroku and other platform providers, you may have a full connection URL
|
173
|
+
# available as an environment variable. For example:
|
174
|
+
#
|
175
|
+
# DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase"
|
176
|
+
#
|
177
|
+
# You can use this database configuration with:
|
178
|
+
#
|
179
|
+
# production:
|
180
|
+
# url: <%= ENV['DATABASE_URL'] %>
|
181
|
+
#
|
182
|
+
production:
|
183
|
+
<<: *default
|
184
|
+
database: LuggageMGT_production
|
185
|
+
username: root
|
186
|
+
password: <%= ENV['DATABASE_PASSWORD'] %>
|
187
|
+
socket: /var/lib/mysql/mysql.sock
|
188
|
+
```
|
189
|
+
|
190
|
+
host: dbをlocalhostにしたりしたのですが、現状何も変わっておりません。
|
191
|
+
お力を貸してください....。
|
2
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -36,7 +36,7 @@
|
|
36
36
|
```
|
37
37
|
|
38
38
|
をし、テーダベースは作成できました。
|
39
|
-
(関係あるかは分かりませんが、docker-compose downをすると、upした後再度rails:
|
39
|
+
(関係あるかは分かりませんが、docker-compose downをすると、upした後再度rails db:createからし直さなければいけない状況です。)
|
40
40
|
|
41
41
|
下記かr該当してそうなファイルを記述致します。
|
42
42
|
まだまだ知識が甘く、変なところもあるかもしれないです。よろしくお願い致します。
|
1
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -101,7 +101,7 @@
|
|
101
101
|
ADD . $APP_ROOT
|
102
102
|
```
|
103
103
|
|
104
|
-
|
104
|
+
circleci/config.yml
|
105
105
|
```
|
106
106
|
version: 2.1
|
107
107
|
orbs:
|