Reputation: 39
I am an absolute beginner in Laravel (v 5.7.2) and I am facing my first real obstacle.
On MAMP, after successfully creating a database via phpmyadmin and a model php artisan make:model [modelname] -m
, when i try to migrate it php artisan migrate
, I get the following error:
Exception trace:
1 PDOException::("PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]") /Applications/MAMP/htdocs/loginsystemLaravel/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=lsapp", "root", "", []) /Applications/MAMP/htdocs/loginsystemLaravel/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
I double checked the files .env and database.php and they ALL have the same configurations.
What is happening?
Upvotes: 0
Views: 2319
Reputation: 1
just look in the .env File what DB_Name Goto phpmyadmin and create a new Database ("Laravel") in my case
Upvotes: 0
Reputation: 39
Finally solved it myself by coincidence. I realized I had both version of mysql installed, mysql8 and mysql57. The first one supports by default cachin sha2 which is not yet supported by laravel. Possible solutions:
1)Change default mysql login method. 2) Use 5.7. 3) Remember to set the same parameters in .env and config/database.php files.
Hope this will help someone else
Upvotes: 0