0

When I type "php artisan migrate" in terminal I see the error below:

In Connection.php line 664:

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



In Connector.php line 67:

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

I'm using mac and Mamp Pro,

**Some other informations: ** php artisan serve => Laravel development server started: http://127.0.0.1:8000

.env file =>

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=1234

In phpMyAdmin top of all things writed => Server: localhost:8889

Local host address when mamp pro ran => http://localhost:8888/phpMyAdmin/

In phpMyAdmin => DB name: laravel Username: root Pass: 1234

Brad Larson
  • 170,088
  • 45
  • 397
  • 571
MRH
  • 1
  • php artisan config:clear – Leo Dec 17 '17 at 16:48
  • Possible duplicate of [MySQL Error: : 'Access denied for user 'root'@'localhost'](https://stackoverflow.com/questions/41645309/mysql-error-access-denied-for-user-rootlocalhost) – BenRoob Dec 17 '17 at 17:23
  • May the following links will help you https://superuser.com/questions/603026/mysql-how-to-fix-access-denied-for-user-rootlocalhost https://stackoverflow.com/questions/39035201/laravel-access-denied-for-user-rootlocalhost-using-password-yes-in-larav – Haseena P A Dec 18 '17 at 04:24
  • what is your db password? in mysql its default blank.... – kaushik Nov 23 '19 at 11:25

2 Answers2

0

This happens when your credentials cannot connect to the defined sql host.

Ideas:

  1. Can you connect with your db credentials using Sequel Pro? https://www.sequelpro.com.
  2. Be sure you grant laravel db permissions for your user.
skylerfenn
  • 354
  • 3
  • 10
0

Try changing DB_HOST=127.0.0.1 to DB_HOST=localhost

Jeremy Anderson
  • 826
  • 5
  • 16