Support the ongoing development of Laravel.io →
Database Laravel Installation
Last updated 1 year ago.
0

Try to check out the .env file in your laravel application folder first The configuration is something like below

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

If you don't see any database configuration in the .env file, maybe you need to add connection information for your root user in this .env file

0

@KhanhNguyen, Thank you.

As I stated in my original post, my database connection configuration is fine because I can run DB queries on my index page just fine, but if I try to do anything database related on my console like a artisan migrate or use artisan tinker to create entries to my database, I get the error I mentioned.

0

For some reason, when using Vagrant-Homestead dev environment you may need to change the DB port on your environment file if you want to work with the database from a command line (artisan or tinker)

Try replacing the DB port to 33060 in the .ENV file to run php artisan and change it back to 3306 when loading you app in a web browser.

0

I second with Luis here, Try replacing the DB port to 33060 in the .ENV file to run php artisan and change it back to 3306 when loading you app in a web browser.

0

For those looking for a solution and who are in a similar position I posted my solution on StackOverflow

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Verdi frenchmajesty Joined 8 Oct 2017

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.