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

質問編集履歴

1

試したことを追記

2020/12/11 09:32

投稿

nishi222
nishi222

スコア1

title CHANGED
File without changes
body CHANGED
@@ -1,13 +1,14 @@
1
1
  Dockerのmysqlにログインしようとすると以下のメッセージが出ます。
2
2
  実行ファイルが所定の場所に見当たらないというエラーだと思うのですが、どこに、何を置けば解決しそうかがわかりません。
3
3
  ご教授頂けますでしょうか。
4
-
4
+ ```
5
5
  docker-compose exec app mysql -h db -u test_user -D test -p
6
6
  OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"mysql\": executable file not found in $PATH": unknown
7
+ ```
7
8
 
8
9
  docker-compose psで確認すると以下のようになっており、dbコンテナは起動していると思うのですが、
9
10
  ログインできない理由が分かりません。
10
-
11
+ ```
11
12
  Name Command State Ports
12
13
  -------------------------------------------------------
13
14
  part1_app_1 docker-php- Up 0.0.0.0:60080->
@@ -15,4 +16,31 @@
15
16
  ...
16
17
  part1_db_1 docker- Up 0.0.0.0:63306->
17
18
  entrypoint.sh 3306/tcp,
18
- mysqld 33060/tcp
19
+ mysqld 33060/tcp
20
+ ```
21
+
22
+ 以下の手順で実行すると、mysqlに接続できているようです。
23
+ $ docker exec -it part1_db_1 bash
24
+ mysql -u test_user -p
25
+
26
+ ```
27
+ $ docker exec -it part1_db_1 bash
28
+ root@61b38d80de09:/# mysql -u test_user -p
29
+ Enter password:
30
+ Welcome to the MySQL monitor. Commands end with ; or \g.
31
+ Your MySQL connection id is 8
32
+ Server version: 8.0.22 MySQL Community Server - GPL
33
+
34
+ Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
35
+
36
+ Oracle is a registered trademark of Oracle Corporation and/or its
37
+ affiliates. Other names may be trademarks of their respective
38
+ owners.
39
+
40
+ Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
41
+
42
+ mysql>
43
+ ```
44
+
45
+ docker-compose exec app mysql -h db -u test_user -D test -p
46
+ だとエラーになる理由をご教授頂けますでしょうか。