I am using Laravel to connect to MySQL database.
I got this exception:
PDOException
SQLSTATE[HY000] [1049] Unknown database \'forge\'
In my particular case, I finally realised that my phpMyAdmin was using port 3308 while Laravel was attempting to connect through 3306. so my advice would be to ensure you have the correct connection string!
I had this problem for several days, it turns out if I created the db inside phpMyAdmin it wouldn't appear to Laravel, so, I created the db through MySqlWorkbench, and it worked :)
You have to clear the cache like that (because your old configuration is in you cache file) :
php artisan cache:clear
The pdo error comes from the fact Laravel use the pdo driver to connect to mysql
You need to modify the name of the DB in the file .env (and if need in .env.example) I solved my problem with this little correction.
write
php artisan config:cache
in your terminal and it will be fixed