0

I'm using command "php artisan migrate" but it shows error as Access denied for user, My all migrations have been created successfully but they are unable to migrate in localhost phpmyadmin?

In comand promt I successfully created migrations but they are unable to migrate in localhost phpmyadmin, I have tried all configration settings but it doesn't work.

In Connection.php line 647:

SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) (SQL: select * from informati on_schema.tables where table_schema = Blog and table_name = migrations)

In Connector.php line 68:

SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)

Khadija Saeed
  • 27
  • 1
  • 3
  • 10

1 Answers1

0

The error means the database login details specified for your app is incorrect. And it seems you didn't supply DB_PASSWORD value in the env file. Check the login details (username and password) and also ensure the user has the privilege to access the specified database.

To confirm that login details are correct, open a terminal and run: mysql -u DB_USERNAME -p (replace DB_USERNAME with your db username e.g root), it'll prompt for a password, enter the password (if any) and press ENTER. If all went well, you should see something like this:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.18 Homebrew

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
djunehor
  • 941
  • 7
  • 9
  • Actually when I installed phpmyadmin I added my username :khadija and password:zx2ct but later on I changed it to username:root and password:' '. And in env file and all other configration files I also did the same changing but now my localhost login with previous username and password but can't show results in php artisan – Khadija Saeed Nov 05 '19 at 05:28
  • Try changing the db username and password again, then set in your .env file. Run `php artisan config:clear` to ensure config is updated and try again – djunehor Nov 05 '19 at 13:27