Error while trying to create a Migration in the Laravel

Asked

Viewed 145 times

0

I just created a new project in Laravel, but when creating a Migration, there is an error in the database.

I have tried to create a new database or use an existing one, but the problem remains.

Follow the mistake I’m having

 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 and table_type = 'BASE TABLE')

PDOException::("SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)")
      /home/pc-root/Área de Trabalho/laravel/blog/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70

PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=homestead", "homestead", "secret", [])
      /home/pc-root/Área de Trabalho/laravel/blog/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70

I wonder how I can solve this problem.

  • the file . env is configured with the BD name, user and password?

  • Yes... with the same data presented above.

  • The database does not exist yet... should already exist when creating the project?

  • Managed to solve your problem?

  • Verify that the user intended to use the bank has the correct access permissions, including depending on the environment it is necessary to establish the access hosts to the bank. Take this example

1 answer

1


1- Create the database,

2 - These are the files of your project:

Arquivos da instalação Laravel

3 - Open the file . env check that the database data is correctly configured. If you are using mysql it looks like this.

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=NomeDoBanco
DB_USERNAME=root
DB_PASSWORD=NormalmenteSemSenha

normally if it is Localhost the user is root and has no password, but ai already varies as you created.

After connected try to run your Migration

Browser other questions tagged

You are not signed in. Login or sign up in order to post.