質問編集履歴

8

修正

2020/09/14 04:43

投稿

tomsuma
tomsuma

score0

test CHANGED
File without changes
test CHANGED
@@ -339,3 +339,25 @@
339
339
  # socket: /var/lib/mysql/mysql.sock
340
340
 
341
341
  ```
342
+
343
+
344
+
345
+ ```
346
+
347
+ mysqlリスタート後
348
+
349
+
350
+
351
+ % docker-compose run web bundle exec rake db:create
352
+
353
+
354
+
355
+ Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
356
+
357
+ Couldn't create 'Books_development' database. Please check your configuration.
358
+
359
+ rake aborted!
360
+
361
+ Mysql2::Error::ConnectionError: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
362
+
363
+ ```

7

修正

2020/09/14 04:38

投稿

tomsuma
tomsuma

score0

test CHANGED
File without changes
test CHANGED
@@ -270,6 +270,8 @@
270
270
 
271
271
  ```
272
272
 
273
+ 修正後エラー
274
+
273
275
  Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
274
276
 
275
277
  Couldn't create 'Books_development' database. Please check your configuration.

6

修正

2020/09/13 23:36

投稿

tomsuma
tomsuma

score0

test CHANGED
File without changes
test CHANGED
@@ -265,3 +265,75 @@
265
265
 
266
266
 
267
267
  ```
268
+
269
+
270
+
271
+ ```
272
+
273
+ Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
274
+
275
+ Couldn't create 'Books_development' database. Please check your configuration.
276
+
277
+ rake aborted!
278
+
279
+ Mysql2::Error::ConnectionError: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
280
+
281
+ /usr/local/bundle/gems/mysql2-0.5.3/lib/mysql2/client.rb:90:in `connect'
282
+
283
+ ```
284
+
285
+ ```database
286
+
287
+
288
+
289
+ default: &default
290
+
291
+ adapter: mysql2
292
+
293
+ encoding: utf8
294
+
295
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
296
+
297
+ username: root
298
+
299
+ password: <%= ENV['DATABASE_PASSWORD'] %>
300
+
301
+ # socket: /tmp/mysql.sock
302
+
303
+
304
+
305
+ host: localhost
306
+
307
+
308
+
309
+ development:
310
+
311
+ <<: *default
312
+
313
+ database: Books_development
314
+
315
+
316
+
317
+ test:
318
+
319
+ <<: *default
320
+
321
+ database: Books_test
322
+
323
+
324
+
325
+ production:
326
+
327
+ <<: *default
328
+
329
+ database: Books_production
330
+
331
+
332
+
333
+ username: root
334
+
335
+ password: <%= ENV['DATABASE_PASSWORD'] %>
336
+
337
+ # socket: /var/lib/mysql/mysql.sock
338
+
339
+ ```

5

修正

2020/09/13 23:35

投稿

tomsuma
tomsuma

score0

test CHANGED
File without changes
test CHANGED
@@ -218,6 +218,18 @@
218
218
 
219
219
  ```
220
220
 
221
+ docker-compose down --rmi all --volumes
222
+
223
+
224
+
225
+ Books % docker-compose build
226
+
227
+
228
+
229
+ Books % docker-compose run web bundle exec rake db:create
230
+
231
+
232
+
221
233
  Creating books_db_1 ... done
222
234
 
223
235
  Creating books_web_run ... done

4

修正

2020/09/13 22:55

投稿

tomsuma
tomsuma

score0

test CHANGED
File without changes
test CHANGED
@@ -218,10 +218,38 @@
218
218
 
219
219
  ```
220
220
 
221
+ Creating books_db_1 ... done
222
+
223
+ Creating books_web_run ... done
224
+
225
+ Can't connect to MySQL server on 'fukusyun-2.local' (22)
226
+
227
+ Couldn't create 'Books_development' database. Please check your configuration.
228
+
229
+ rake aborted!
230
+
231
+ Mysql2::Error::ConnectionError: Can't connect to MySQL server on 'fukusyun-2.local' (22)
232
+
233
+ /usr/local/bundle/gems/mysql2-0.5.3/lib/mysql2/client.rb:90:in `connect'
234
+
235
+
236
+
237
+
238
+
221
- mysql> show databases
239
+ mysql> show variables like 'hostname';
240
+
222
-
241
+ +---------------+------------------+
242
+
243
+ | Variable_name | Value |
244
+
245
+ +---------------+------------------+
246
+
247
+ | hostname | fukusyun-2.local |
248
+
249
+ +---------------+------------------+
250
+
223
- -> SHOW DATABASES;
251
+ 1 row in set (0.00 sec)
224
-
225
- ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SHOW DATABASES' at line 2
252
+
226
-
253
+
254
+
227
- ```
255
+ ```

3

修正

2020/09/13 22:52

投稿

tomsuma
tomsuma

score0

test CHANGED
File without changes
test CHANGED
@@ -213,3 +213,15 @@
213
213
  ERROR! Failed to stop running server, so refusing to try to start.
214
214
 
215
215
  ```
216
+
217
+
218
+
219
+ ```
220
+
221
+ mysql> show databases
222
+
223
+ -> SHOW DATABASES;
224
+
225
+ ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SHOW DATABASES' at line 2
226
+
227
+ ```

2

修正

2020/09/13 22:44

投稿

tomsuma
tomsuma

score0

test CHANGED
File without changes
test CHANGED
@@ -10,6 +10,18 @@
10
10
 
11
11
 
12
12
 
13
+ docker-compose run web bundle exec rake db:create
14
+
15
+ しても同じようなエラーが出ます
16
+
17
+
18
+
19
+ ```
20
+
21
+ Mysql2::Error::ConnectionError: Can't connect to MySQL server on 'db' (115)
22
+
23
+ ```
24
+
13
25
  ```dockercompose
14
26
 
15
27
  version: '3'
@@ -66,6 +78,58 @@
66
78
 
67
79
  ```
68
80
 
81
+
82
+
83
+ ```dockerfile
84
+
85
+ FROM ruby:2.6.5
86
+
87
+
88
+
89
+
90
+
91
+ RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
92
+
93
+ && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
94
+
95
+
96
+
97
+ RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs yarn
98
+
99
+
100
+
101
+ WORKDIR /Books/
102
+
103
+ COPY Gemfile ./Gemfile
104
+
105
+ COPY Gemfile.lock ./Gemfile.lock
106
+
107
+ RUN gem install bundler
108
+
109
+ RUN bundle install
110
+
111
+ COPY . /Books/
112
+
113
+
114
+
115
+ # Add a script to be executed every time the container starts.
116
+
117
+ COPY entrypoint.sh /usr/bin/
118
+
119
+ RUN chmod +x /usr/bin/entrypoint.sh
120
+
121
+ ENTRYPOINT ["entrypoint.sh"]
122
+
123
+ EXPOSE 3000
124
+
125
+
126
+
127
+ # Start the main process.
128
+
129
+ CMD ["rails", "server", "-b", "0.0.0.0"]
130
+
131
+ ```
132
+
69
133
  ```database
70
134
 
71
135
 

1

修正

2020/09/13 22:36

投稿

tomsuma
tomsuma

score0

test CHANGED
@@ -1 +1 @@
1
- JSで++を用いた足し算が反映されない
1
+ Unknown MySQL server host 'db' (0)
test CHANGED
@@ -1,125 +1,151 @@
1
- 画像のライドはうまいっているにも関わらずcurrentslideの部分プラスされていせん。どこが原因でしょうか?
1
+ rails s でローカルホトを開とこエラーしまいま
2
2
 
3
3
 
4
4
 
5
- ```html
5
+ ジェムファイルの内容を消して
6
6
 
7
- <div class="footer_logo_bar_bg ">
7
+ bundle installたり、何種類かコマンドを試したのですがだめでした。
8
8
 
9
- <p class="footer_logo_bar_bg_prev " onclick="footer_prev() "><img src="img/btn_prev_01.png "></p>
10
9
 
11
- <div class="footer_slider ">
12
10
 
13
- <ul id="footer_slides " class="footer_slides ">
14
11
 
15
- <li class="footer_slide "><img src="img/bnr_footer_01.png "></li>
16
12
 
17
- <li class="footer_slide "><img src="img/bnr_footer_02.png "></li>
13
+ ```dockercompose
18
14
 
19
- <li class="footer_slide "><img src="img/bnr_footer_04.png "></li>
15
+ version: '3'
20
16
 
21
- <li class="footer_slide "><img src="img/bnr_footer_05.png "></li>
17
+ services:
22
18
 
23
- <li class="footer_slide "><img src="img/bnr_footer_06.png "></li>
19
+ db:
24
20
 
25
- <li class="footer_slide "><img src="img/bnr_footer_07.png "></li>
21
+ image: mysql:5.6
26
22
 
27
- <li class="footer_slide "><img src="img/bnr_footer_08.png "></li>
23
+ environment:
28
24
 
29
- <li class="footer_slide "><img src="img/bnr_footer_09.png "></li>
25
+ MYSQL_ROOT_PASSWORD: example
30
26
 
31
- <li class="footer_slide "><img src="img/bnr_footer_10.png "></li>
27
+ MYSQL_DATABASE: root
32
28
 
33
- <li class="footer_slide "><img src="img/bnr_footer_11.png "></li>
29
+ ports:
34
30
 
35
- <li class="footer_slide "><img src="img/bnr_footer_01.png "></li>
31
+ - "4306:3306"
36
32
 
37
- </ul>
33
+ volumes:
38
34
 
39
- </div>
35
+ - mysql-data:/var/lib/mysql
40
36
 
41
- <p class="footer_logo_bar_bg_next " onclick="footer_next() "><img class="footer_logo_bar_bg_next " src="img/btn_next_01.png "></p>
37
+ web:
42
38
 
39
+ build: .
40
+
41
+ environment:
42
+
43
+ DATABASE_PASSWORD: example
44
+
45
+ command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
46
+
47
+ volumes:
48
+
43
- </div>
49
+ - .:/Books
50
+
51
+ ports:
52
+
53
+ - 3000:3000
54
+
55
+ depends_on:
56
+
57
+ - db
58
+
59
+ tty: true
60
+
61
+ stdin_open: true
62
+
63
+ volumes:
64
+
65
+ mysql-data:
44
66
 
45
67
  ```
46
68
 
47
- ``` CSS
69
+ ```database
48
70
 
49
- .footer_slider {
50
71
 
51
- width: 60vw;
52
72
 
53
- overflow: hidden;
73
+ default: &default
54
74
 
55
- margin-top: 20px;
75
+ adapter: mysql2
56
76
 
57
- }
77
+ encoding: utf8
58
78
 
59
-
79
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
60
80
 
61
- .footer_slides {
81
+ username: root
62
82
 
63
- width: 165vw;
83
+ password: example
64
84
 
65
- overflow: hidden;
85
+ # socket: /tmp/mysql.sock
66
86
 
67
- }
68
87
 
69
-
70
88
 
71
- .footer_slide {
89
+ host: db
72
90
 
73
- float: left;
74
91
 
75
- padding: 0 5px;
76
92
 
77
- width: 15vw;
93
+ development:
78
94
 
95
+ <<: *default
96
+
97
+ database: Books_development
98
+
99
+
100
+
79
- }
101
+ test:
102
+
103
+ <<: *default
104
+
105
+ database: Books_test
106
+
107
+
108
+
109
+ production:
110
+
111
+ <<: *default
112
+
113
+ database: Books_production
114
+
115
+
116
+
117
+ username: root
118
+
119
+ password: <%= ENV['DATABASE_PASSWORD'] %>
120
+
121
+ # socket: /var/lib/mysql/mysql.sock
80
122
 
81
123
  ```
82
124
 
83
- ```js
84
125
 
85
- var $footer_slides = $(".footer_slides");
86
126
 
87
- var currentslide = 1;
127
+ ```
88
128
 
89
- var slideCount = 8;
129
+ brew install mysql
90
-
91
- var footer_slidetime = 3000;
92
-
93
- var animationtime = 1000;
94
130
 
95
131
 
96
132
 
97
- // 横移動のスライドショー
98
-
99
- setInterval(function() {
100
-
101
- $footer_slides.animate({
102
-
103
- 'marginLeft': '-=15vw'
104
-
105
- }, animationtime, function() {
106
-
107
- currentslide++;
133
+ brew reinstall mysql
108
-
109
- if (currentslide === slideCount) {
110
-
111
- currentslide = 1;
112
-
113
- $(this).css("margin-left ", "0vw ");
114
-
115
- }
116
-
117
- });
118
-
119
- }, footer_slidetime);
120
134
 
121
135
 
122
136
 
137
+ sudo chown -R user /usr/local/var/mysql
138
+
139
+
140
+
123
- console.log(currentslide);
141
+ mysql.server restart
142
+
143
+
144
+
145
+ Shutting down MySQL
146
+
147
+ .. ERROR! The server quit without updating PID file (/usr/local/var/mysql/fukusyun-2.local.pid).
148
+
149
+ ERROR! Failed to stop running server, so refusing to try to start.
124
150
 
125
151
  ```