0
votes

I am new to php-laravel. I am learning laravel from this tutorial on laracast:

https://laracasts.com/series/laravel-5-from-scratch/episodes/7?autoplay=true

I wrote code like this video but I am getting the following errors for the database, and I do not understand:

[Illuminate\Database\QueryException]
SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES) (SQL: select * from information_schema.tables
where table_schema = homestead and table_name = migrations)

[PDOException]
SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)

Does anyone have any idea how to solve it?

2
You have not created a database with the name 'homestead'. You have to create your database first.Fatimah
@FatimahSanni what makes you say that for sure? Looks like "homestead" is the username, and maybe also the DB name. It's just as likely that either the user doesn't exist, the wrong password is supplied, or the user's host access config is wrong.ADyson

2 Answers

2
votes

Do you have a .env file? If so, you have to edit the following values:

DB_HOST=127.0.0.1          //where your database hosted
DB_DATABASE=databasename   //this database has to be created manually
DB_USERNAME=username       //the username used to access your databases
DB_PASSWORD=password       //the password

If you are running it on a vagrantbox, the username & password is usually root & vagrant by default

0
votes

Going off what @pseudoanime stated (need 50 reputation or higher to comment):

The error provided is the standard error you get when you try to do your first migration in laravel.

Here are the settings that help people getting started

DB_HOST=127.0.0.1                 //where your database hosted
DB_DATABASE=name_of_the_project   //this database may exist if you are using laragon 
                                    check your mysql workbench or whatever you are using       
                                    along laragon
DB_USERNAME=root                  //the default superuser of a database 
                                  //I took out the password field because by default 
                                  //the root user doesn't have a password

Please note this should never be used in a production site, this is just the settings to help you get started using laravel