質問編集履歴

3

進展

2021/03/01 02:32

投稿

k_takahashi
k_takahashi

スコア6

test CHANGED
File without changes
test CHANGED
@@ -50,7 +50,9 @@
50
50
 
51
51
 
52
52
 
53
+ ### 関連すると考えられるもの
54
+
53
- ### .envの内容
55
+ ###### .envファイル】
54
56
 
55
57
  * プロジェクト配下の.env
56
58
 
@@ -100,7 +102,7 @@
100
102
 
101
103
 
102
104
 
103
- ### 新しく作成したユーザの権限
105
+ ###### 新しく作成したユーザの権限
104
106
 
105
107
  bashから確認した権限
106
108
 
@@ -152,17 +154,27 @@
152
154
 
153
155
 
154
156
 
155
- ### 試したこと
157
+ ### 進展
158
+
156
-
159
+ 進展かはわからないのですが、状況に少し変化がありました。
160
+
157
- * プロジェト配下の.env
161
+ キャッシュのリア試しました。
158
-
162
+
159
- ```
163
+ ```
164
+
160
-
165
+ laradock@ba290d4aab8c:/var/www$ php artisan cache:clear
166
+
161
- DB_HOST=mysql
167
+ Cache cleared successfully.
168
+
162
-
169
+ laradock@ba290d4aab8c:/var/www$ php artisan config:cache
170
+
171
+ Configuration cache cleared!
172
+
173
+ Configuration cached successfully!
174
+
163
- ```
175
+ ```
164
-
176
+
165
- 上記に修正した状態で`php artisan migrate`を実行した際も、特にエラー内容変わらず下記の通り。
177
+ その後、`php artisan migrate`を実行すると下記のエラーになました
166
178
 
167
179
  ```
168
180
 
@@ -174,9 +186,9 @@
174
186
 
175
187
 
176
188
 
177
- SQLSTATE[HY000] [1045] Access denied for user 'default'@'172.19.0.4' (using password: YES) (SQL: select * from information_schema.tables where t
189
+ SQLSTATE[HY000] [1045] Access denied for user 'xxxx'@'172.19.0.4' (using password: YES) (SQL: select * from information_schema.tables where tabl
178
-
190
+
179
- able_schema = default and table_name = migrations)
191
+ e_schema = xxxxDB and table_name = migrations)
180
192
 
181
193
 
182
194
 
@@ -186,93 +198,15 @@
186
198
 
187
199
 
188
200
 
189
- SQLSTATE[HY000] [1045] Access denied for user 'default'@'172.19.0.4' (using password: YES)
201
+ SQLSTATE[HY000] [1045] Access denied for user 'xxxx'@'172.19.0.4' (using password: YES)
190
-
202
+
191
- ```
203
+ ```
192
-
193
- * プロジェクト配下の.envを
204
+
194
-
195
- ```
196
-
197
- DB_HOST=127.0.0.1
198
-
199
- ```
200
-
201
- 上記に修正した状態で`php artisan migrate`を実行。
202
-
203
- (調べた際にこれで実行している方がいたため。理由は理解できておらず)
204
-
205
- 違うエラーが出る。
206
-
207
- ```
208
-
209
- laradock@ba290d4aab8c:/var/www$ php artisan migrate
210
-
211
-
212
-
213
- In Connection.php line 664:
214
-
215
-
216
-
217
- SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from information_schema.tables where tabl
218
-
219
- e_schema = default and table_name = migrations)
205
+ キャッシュのクリア前はdefaultユーザとdefaultDBを使っているようなエラーだったものが、
220
-
221
-
222
-
223
-
224
-
206
+
225
- In Connector.php line 67:
207
+ 今は、.envファイル内で設定したユーザになっています。
226
-
227
-
228
-
229
- SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client
208
+
230
-
231
-
232
-
233
-
234
-
235
- In Connector.php line 67:
236
-
237
-
238
-
239
- PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]
240
-
241
- ```
242
-
243
- 認証方式問題か、下記確認
209
+ エラー内容しては変わってないようすが
244
-
245
- .envファイルで指定しているユーザは`mysql_native_password`になっているため問題はないかと考えている。
246
-
247
- ```
248
-
249
- mysql> SELECT user, host, plugin FROM mysql.user;
250
-
251
- +------------------+-----------+-----------------------+
252
-
253
- | user | host | plugin |
254
-
255
- +------------------+-----------+-----------------------+
256
-
257
- | root | % | mysql_native_password |
258
-
259
- | default | localhost | mysql_native_password |
260
-
261
- | xxxx | localhost | mysql_native_password |
262
-
263
- | mysql.infoschema | localhost | caching_sha2_password |
264
-
265
- | mysql.session | localhost | mysql_native_password |
266
-
267
- | mysql.sys | localhost | mysql_native_password |
268
-
269
- | root | localhost | mysql_native_password |
270
-
271
- +------------------+-----------+-----------------------+
272
-
273
- ```
274
-
275
-
276
210
 
277
211
 
278
212
 

2

試したことを追記

2021/03/01 02:32

投稿

k_takahashi
k_takahashi

スコア6

test CHANGED
File without changes
test CHANGED
@@ -152,6 +152,132 @@
152
152
 
153
153
 
154
154
 
155
+ ### 試したこと
156
+
157
+ * プロジェクト配下の.envを
158
+
159
+ ```
160
+
161
+ DB_HOST=mysql
162
+
163
+ ```
164
+
165
+ 上記に修正した状態で`php artisan migrate`を実行した際も、特にエラー内容変わらず下記の通り。
166
+
167
+ ```
168
+
169
+ laradock@ba290d4aab8c:/var/www$ php artisan migrate
170
+
171
+
172
+
173
+ In Connection.php line 664:
174
+
175
+
176
+
177
+ SQLSTATE[HY000] [1045] Access denied for user 'default'@'172.19.0.4' (using password: YES) (SQL: select * from information_schema.tables where t
178
+
179
+ able_schema = default and table_name = migrations)
180
+
181
+
182
+
183
+
184
+
185
+ In Connector.php line 67:
186
+
187
+
188
+
189
+ SQLSTATE[HY000] [1045] Access denied for user 'default'@'172.19.0.4' (using password: YES)
190
+
191
+ ```
192
+
193
+ * プロジェクト配下の.envを
194
+
195
+ ```
196
+
197
+ DB_HOST=127.0.0.1
198
+
199
+ ```
200
+
201
+ 上記に修正した状態で`php artisan migrate`を実行。
202
+
203
+ (調べた際にこれで実行している方がいたため。理由は理解できておらず)
204
+
205
+ 違うエラーが出る。
206
+
207
+ ```
208
+
209
+ laradock@ba290d4aab8c:/var/www$ php artisan migrate
210
+
211
+
212
+
213
+ In Connection.php line 664:
214
+
215
+
216
+
217
+ SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from information_schema.tables where tabl
218
+
219
+ e_schema = default and table_name = migrations)
220
+
221
+
222
+
223
+
224
+
225
+ In Connector.php line 67:
226
+
227
+
228
+
229
+ SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client
230
+
231
+
232
+
233
+
234
+
235
+ In Connector.php line 67:
236
+
237
+
238
+
239
+ PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]
240
+
241
+ ```
242
+
243
+ 認証方式の問題かと思い、下記で確認。
244
+
245
+ .envファイルで指定しているユーザは`mysql_native_password`になっているため問題はないかと考えている。
246
+
247
+ ```
248
+
249
+ mysql> SELECT user, host, plugin FROM mysql.user;
250
+
251
+ +------------------+-----------+-----------------------+
252
+
253
+ | user | host | plugin |
254
+
255
+ +------------------+-----------+-----------------------+
256
+
257
+ | root | % | mysql_native_password |
258
+
259
+ | default | localhost | mysql_native_password |
260
+
261
+ | xxxx | localhost | mysql_native_password |
262
+
263
+ | mysql.infoschema | localhost | caching_sha2_password |
264
+
265
+ | mysql.session | localhost | mysql_native_password |
266
+
267
+ | mysql.sys | localhost | mysql_native_password |
268
+
269
+ | root | localhost | mysql_native_password |
270
+
271
+ +------------------+-----------+-----------------------+
272
+
273
+ ```
274
+
275
+
276
+
277
+
278
+
279
+
280
+
155
281
  いろいろ調べたり試したりはしたのですが、解決できなかったため
156
282
 
157
283
  教えていただけると幸いです。

1

ユーザの権限についての記載を追記

2021/02/28 16:34

投稿

k_takahashi
k_takahashi

スコア6

test CHANGED
File without changes
test CHANGED
@@ -106,6 +106,36 @@
106
106
 
107
107
  ```
108
108
 
109
+ mysql> select user, host from mysql.user;
110
+
111
+ +------------------+-----------+
112
+
113
+ | user | host |
114
+
115
+ +------------------+-----------+
116
+
117
+ | root | % |
118
+
119
+ | default | localhost |
120
+
121
+ | XXXX | localhost |
122
+
123
+ | mysql.infoschema | localhost |
124
+
125
+ | mysql.session | localhost |
126
+
127
+ | mysql.sys | localhost |
128
+
129
+ | root | localhost |
130
+
131
+ +------------------+-----------+
132
+
133
+ ```
134
+
135
+ ```
136
+
137
+ mysql> show grants for 'xxxx'@'localhost';
138
+
109
139
  +-----------------------------------------------------------+
110
140
 
111
141
  | Grants for XXXX@localhost |