0
votes

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)

1
Run php artisan tinker then type config('database') do the output shows your right database credentials?Elias Soares
Yes, it is showing the correct name of my Database, Username and password etcKhadija Saeed

1 Answers

0
votes

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>