I updated my Mamp Pro application to 6.2 and everything works well. My Symfony is running with the database, so everything is fine.
in the env file I am using this setting:
DATABASE_URL=mysql://root:root@localhost/mypage
Now the problem is, that in the console I want to make a migration, and this is not working anymore
php bin/console doctrine:migrations:diff
I get the error
An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory
After a long research I finally found the solution:
The php version of the terminal did not match the php version of MAMP. I had to use the mamp php version instead of the default osx php version.
1. Locate your osx php version with:
which php
The result should be:
/usr/local/bin/php
2. Backup (move) your original php binary:
sudo mv /usr/local/bin/php /usr/local/bin/php.bak
3. Create the symlink:
sudo ln -s /Applications/MAMP/bin/php/php7.4.12/bin/php /usr/local/bin/php
4. Run your new php version:
php -v