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

This error occurred while trying to migrate from the database to PhpMyAdmin.

My .env file:

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=8889
DB_DATABASE=laravel_blog
DB_USERNAME=root
DB_PASSWORD=root

MAMP start page with MySQL:

Host: localhost
Port: 8889
User: root
Password: root
Socket: /Applications/MAMP/tmp/mysql/mysql.sock

enter image description here

What could be the problem here? P.S. No, clearing the cache / config does not help!

Isaac Bennetch
  • 11,830
  • 2
  • 32
  • 43
  • 1
    have you created database laravel_blog in mysql – mayank modi Apr 19 '20 at 16:59
  • As @TimBrownlaw said, the error returned error is pretty clear. You'll need to figure out yourself what your credentials are. – César Escudero Apr 19 '20 at 17:06
  • php artisan config:clear – phpdroid Apr 19 '20 at 17:07
  • You need to restart your server after .env changes – oceceli Apr 19 '20 at 17:22
  • @TimBrownlaw, how then to come in / use a DB under another user? –  Apr 19 '20 at 17:36
  • Does this answer your question? [Unexpected Exception: SQLSTATE\[HY000\] \[1045\] Access denied for user \*\*\*\*@'localhost' (using password: YES)](https://stackoverflow.com/questions/25031874/unexpected-exception-sqlstatehy000-1045-access-denied-for-user-localh) – Lance Pioch Apr 19 '20 at 18:37
  • Run `mysql -u root -p` on your terminal. When prompted for password, enter `root` and press ENTER/RETURN. If the credentials are correct, you'll be logged in. If not, you'll get that same error. – djunehor Apr 19 '20 at 19:11
  • Just to help fill in some of the gap here, you aren't migrating in to phpMyAdmin, because phpMyAdmin is an application to allow administrators to manage a MySQL or MariaDB database. You can import data through phpMyAdmin in to a MySQL or MariaDB database, but nothing you've posted relates to phpMyAdmin itself (the picture is from an interface I'm not familiar with and the code blocks you've pasted aren't from phpMyAdmin either. I'm glad you sorted out your problem, but just wanted to help you clarify a bit what is going on. – Isaac Bennetch Apr 20 '20 at 18:23

1 Answers1

0

I found what the error was, maybe someone will tell you: in config.inc.php, instead of the user, I registered 'root' and password - the newly created entry, went under it and registered it in the .env file - and everything worked