Laravel pp db error ( the database name is incorrect

92 Views Asked by At

Good day this is the error i got when trying to run my laravel php artisan serve

The error i first got + the second error i got.

Not sure what to do?

Error Statement:

SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' error generated when running :127.0.0.1:8001

Solution tried:

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3630
DB_DATABASE=yourdbname
DB_USERNAME=admin
DB_PASSWORD=adminspassword

and

$ sudo mysql -u root
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'adminspassword';
GRANT ALL PRIVILEGES ON `*`.`*` TO 'admin'@'localhost';
FLUSH PRIVILEGES

Final Error Statment:

I got this

SQLSTATE[HY000] [1049] Unknown database 'laravel'

1

There are 1 best solutions below

0
On

The problem is that you have not created a database.

So, what you need to do is:

sudo mysql
CREATE DATABASE yourdbname;

now you can start building user and permissions in the db.