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

質問編集履歴

2

追記2

2021/07/05 08:13

投稿

ETO3
ETO3

スコア45

title CHANGED
File without changes
body CHANGED
@@ -44,4 +44,26 @@
44
44
  ```
45
45
 
46
46
  と似たようなエラーがでました。
47
- コンテナからの接続先が違うのでしょうか?
47
+ コンテナからの接続先が違うのでしょうか?
48
+
49
+
50
+ #追記2
51
+ docker-compose.ymlは以下の形です。
52
+
53
+ ```docker-compose.yml
54
+ # db
55
+ db:
56
+ image: mariadb
57
+ container_name: database_mariadb
58
+ environment:
59
+ MYSQL_ROOT_PASSWORD: root
60
+ MYSQL_DATABASE: database
61
+ MYSQL_USER: root
62
+ MYSQL_PASSWORD: root
63
+ TZ: 'Asia/Tokyo'
64
+ command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
65
+ volumes:
66
+ - ./docker/db/data:/var/lib/mysql
67
+ ports:
68
+ - 3306:3306
69
+ ```

1

追記

2021/07/05 08:13

投稿

ETO3
ETO3

スコア45

title CHANGED
File without changes
body CHANGED
@@ -21,4 +21,27 @@
21
21
  DB_PASSWORD=root
22
22
  ```
23
23
 
24
- ご教授の程よろしくお願いします。
24
+ ご教授の程よろしくお願いします。
25
+
26
+ #追記
27
+ マイグレーションが通るのはローカルでのみみたいです。
28
+
29
+ コンテナの中でphp artisan migrate をすると
30
+
31
+ ```
32
+ SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = database and table_name = migrations and table_type = 'BASE TABLE')
33
+
34
+ at vendor/laravel/framework/src/Illuminate/Database/Connection.php:692
35
+ 688▕ // If an exception occurs when attempting to run a query, we'll format the error
36
+ 689▕ // message to include the bindings with SQL, which will make this exception a
37
+ 690▕ // lot more helpful to the developer instead of just the database's errors.
38
+ 691▕ catch (Exception $e) {
39
+ ➜ 692▕ throw new QueryException(
40
+ 693▕ $query, $this->prepareBindings($bindings), $e
41
+ 694▕ );
42
+ 695▕ }
43
+ 696▕
44
+ ```
45
+
46
+ と似たようなエラーがでました。
47
+ コンテナからの接続先が違うのでしょうか?