New code is published. You pull it from main and try to run, then there you go: "SQL ERROR" on your face. Now, make some database migrations which won't work of-course. Finally, you receive a database backup file and import it in your database. 3, 2, 1, there you go, Your App is crashed. Congratulations. Did this happen to you? What went wrong? What to do exactly after a database update in laravel ? Learn more from w3schools.com
Figure: MySQL database update
After updating database in MySQL, first thing you need to do is generate new keys.
php artisan key:generate
Then, You need to renew Client Secret with passport install.
php artisan passport:install
That is all you need but You could have avoided all these hassle if you setup migrations correctly. Try your luck and migrate your database. To make migrations in database:
php artisan migrate --path={pathname}
Still no fix? Your cache might have been a problem here. Try To optimize all settings
php artisan optimize
What if you just need to clear route cache? Do this To optimize route:
php artisan route:clear
How about clearing only config? This is how its done:
php artisan config:clear
Now run your laravel app once again to see if it works
php artisan serve
Hopefully, now you know what to do after database update in laravel and your application is up and running. But if its not you can contact us for help. click here to stay in touch with us and to see more blog posts like this see our latest posts.