Laravel で DB接続エラー
上記教材でLaravel学習2日目。
マイグレーションができずに小一時間ハマった。。。
In Connection.php line 664: SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES) (SQL: select * from information_schema.ta
bles where table_schema = homestead and table_name = migrations) In Connector.php line 67: SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)
先に解決方法を言います。
Homestead内でssh接続して、プロジェクトに移動しmigrateを実行する!
そうです。
ずっと
ローカルのプロジェクトディレクトリでコマンド叩いてた。。。
これに気づかず.envとdatabase.phpをいじり倒した。。。
参考
Laravelのphp artisan migrateでSQLSTATE[HY000] [2002] Connection refusedが返る - Qiita
https://niwacan.com/1408-laravel-db-ini/