お世話になります。今年エンジニア見習いとして社会人となりましたKonoLv1と申します。
現在、Laravelについて勉強しており下記のサイトのチュートリアルを行っているところです。
Laravel 7 Tutorial For Beginners
端末:MAC
環境:Homestead
Step 3: Create Migrationを進めていたところ、下記のエラーによりうんともすんとも進めなくなったので
解決策をご存知の方がいらっしゃいましたらご教授いただけましたら幸いです。
何卒よろしくお願いいたします。
php artisan migrate Illuminate\Database\QueryException SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = blog and table_name = migrations and table_type = 'BASE TABLE') at vendor/laravel/framework/src/Illuminate/Database/Connection.php:670 666| // If an exception occurs when attempting to run a query, we'll format the error 667| // message to include the bindings with SQL, which will make this exception a 668| // lot more helpful to the developer instead of just the database's errors. 669| catch (Exception $e) { > 670| throw new QueryException( 671| $query, $this->prepareBindings($bindings), $e 672| ); 673| } 674| +37 vendor frames 38 artisan:37 Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
下記のサイトを参考しましたが、下記の部分がいまいちわからず解決には至っておりません。
参考サイト
追加情報(.env)
APP_NAME=blog APP_ENV=local APP_KEY=base64:1QJrB*********= APP_DEBUG=true APP_URL=http://localhost LOG_CHANNEL=stack DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=blog DB_USERNAME=root DB_PASSWORD= BROADCAST_DRIVER=log CACHE_DRIVER=file QUEUE_CONNECTION=sync SESSION_DRIVER=file SESSION_LIFETIME=120 REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_MAILER=smtp MAIL_HOST=smtp.mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null MAIL_FROM_ADDRESS=null MAIL_FROM_NAME="${APP_NAME}" AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_DEFAULT_REGION=us-east-1 AWS_BUCKET= PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= PUSHER_APP_CLUSTER=mt1 MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
追加情報2
追加情報3
追加情報4(ターミナル)
***@***MacBook-Pro blog % php artisan config:clear Configuration cache cleared! ***@***MacBook-Pro blog % php artisan migrate Illuminate\Database\QueryException SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = homestead and table_name = migrations and table_type = 'BASE TABLE') at vendor/laravel/framework/src/Illuminate/Database/Connection.php:670 666| // If an exception occurs when attempting to run a query, we'll format the error 667| // message to include the bindings with SQL, which will make this exception a 668| // lot more helpful to the developer instead of just the database's errors. 669| catch (Exception $e) { > 670| throw new QueryException( 671| $query, $this->prepareBindings($bindings), $e 672| ); 673| } 674| • Database name seems incorrect: You're using the default database name `homestead`. This database does not exist. Edit the `.env` file and use the correct database name in the `DB_DATABASE` key. https://laravel.com/docs/master/database#configuration +37 vendor frames 38 artisan:37 Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) ***@***MacBook-Pro blog %
DB_DATABASE=homestead DB_USERNAME=homestead DB_PASSWORD=secret
ターミナルで
php artisan migrate
を打ち込む前に、
cd Homestead
vagrant ssh
cd ~/code
php artisan migrate
と手順を踏むことにより解決しましたが、その後また躓いたため、継続させていただきます。
Illuminate\Database\QueryException SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES) (SQL: select count(*) as aggregate from `products`)
チュートリアルを最後まで行ったところ、表示されたページがこのようになっております。
引き続きご教授いただけましたら幸いです。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/04/05 07:23
2020/04/05 07:28
2020/04/05 08:31
退会済みユーザー
2020/04/05 08:36
2020/04/05 08:45
2020/04/05 08:46
退会済みユーザー
2020/04/05 08:47
退会済みユーザー
2020/04/05 08:48
2020/04/05 09:02
退会済みユーザー
2020/04/05 09:16
2020/04/05 10:39
2020/04/05 11:01