質問編集履歴
1
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,15 +1,19 @@
|
|
1
1
|
docker環境のlaravelでmigrateを行いたいのですが、php artisan migrateを実行すると下記のようなエラーが出ます。
|
2
2
|
|
3
|
+
```ここに言語を入力
|
3
4
|
SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations and table_type = 'BASE TABLE')
|
4
|
-
|
5
|
+
```
|
5
|
-
|
6
6
|
参考にしたサイト
|
7
|
+
```ここに言語を入力
|
7
8
|
https://qiita.com/isaatsu0131/items/50f8dca389b60a1fd5b5
|
9
|
+
```
|
8
10
|
|
9
11
|
上記を参考に.envファイル内のDB_HOSTをdocker-comose.ymlで設定したDB_HOST=dbに書き直したのですが、次は下記のようなエラーが出ます。
|
10
|
-
|
12
|
+
```ここに言語を入力
|
11
13
|
SQLSTATE[HY000] [1045] Access denied for user 'root'@'172.19.0.2' (using password: NO) (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations and table_type = 'BASE TABLE')
|
12
14
|
|
15
|
+
```
|
16
|
+
|
13
17
|
エラー文を読むとアクセスが拒否されるとのことですが、下記を試した後にrestartしたのですがエラーが変わりません。
|
14
18
|
|
15
19
|
試したこと
|
@@ -20,8 +24,8 @@
|
|
20
24
|
https://qiita.com/fumi_042/items/7d1c14e335ab1c226e0f
|
21
25
|
https://shiro-changelife.com/laravel-access-denied/
|
22
26
|
|
23
|
-
|
24
27
|
【.env】
|
28
|
+
```ここに言語を入力
|
25
29
|
APP_NAME=Laravel
|
26
30
|
APP_ENV=local
|
27
31
|
APP_KEY=base64:dUXJ1/2fc5+MoFsvQZgk/2nf2YVW8FMM3HLrqLba56I=
|
@@ -70,10 +74,13 @@
|
|
70
74
|
|
71
75
|
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
72
76
|
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
77
|
+
```
|
73
78
|
|
74
79
|
|
75
80
|
|
81
|
+
|
76
82
|
【docker-compose.yml】
|
83
|
+
```ここに言語を入力
|
77
84
|
version: '3'
|
78
85
|
|
79
86
|
services:
|
@@ -109,4 +116,5 @@
|
|
109
116
|
- ./docker/db/my.cnf:/etc/mysql/conf.d/my.cnf
|
110
117
|
- ./docker/db/sql:/docker-entrypoint-initdb.d
|
111
118
|
ports:
|
112
|
-
- 3306:3306
|
119
|
+
- 3306:3306
|
120
|
+
```
|