Home > front end >  Cannot migrate SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost'
Cannot migrate SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost'

Time:01-28

I just cloned a website project on GitHub. When I want to migrate, an error like this appears. I have filled in DB_DATABASE and DB_USERNAME many times but it has no effect

.env

APP_NAME="Simple Company Profile"
APP_ENV=local
APP_KEY=base64:HLQuGR0tT28YYt4eg/GPPQpW4L mii71zIx65nFNxDE=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=cms_pasti
DB_USERNAME=
DB_PASSWORD=

there is also a simple console here to create an admin account, but that also doesn't work enter image description here

CodePudding user response:

I don't think that cloning a project will automatically replicate the database. You have to create it with a script/sql. Which should be part of the Github project.

So,

  • Either find the schema and create the database and tables manually.
  • Or find a sql backup and restore it

CodePudding user response:

You have just cloned the repository but, that doesn´t mean that is ready to run. You have to create a database and connect with it.

Use PHPMyAdmin or any other Database management solution (HeidiSQL, MySQL WorkBench) in order to check if your Database credentials are working.

Another thing that is probably happening is that you have to create the database 'cms_pasti' first and then fill the .env:

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=cms_pasti
DB_USERNAME=
DB_PASSWORD=

With the proper settings.

When done, you have to run in your console:

PHP artisan migrate

This command will do the migrations to build the database structure. But you have to be sure that the database is already created.

  • Related