Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

snehakulal7's avatar

Database sync

How to sync the local database to the server database automatically for every 30 minutes in laravel?Please can anyone answer?

0 likes
1 reply
lostdreamer_nl's avatar

You could simply do a mysqldump locally, and use a DB seeder or even a migration to import the .sql file:

        $res = DB::unprepared(file_get_contents(database_path('import.sql')));

But normally, you'd have your local DB created by using a combination of migrations (creating the tables) and DB Seeders (filling in the DB)

If you did so, you could put your project online and simpyl run

php artisan migrate:fresh --seed

Please or to participate in this conversation.