In this article, we will discuss "How to Create Database Backup in Laravel" . In this, we are not going to use any additional package. We will create our artisan command for DB backup and schedule the same for daily or our desired time. Database backup is a basic requirement of each project where we use a database. So we maintain the different services to take database backup. Some of the hosting providers, provide us daily backup for databases and files. Create Laravel Project Use the following composer command to install the fresh copy of Laravel. composer create-project laravel/laravel laravel-project --prefer-dist Establish Connection with DB Open the ".env" file, located at the root of the Laravel project, and update the required DB credentials. DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=laravel8 DB_USERNAME=root DB_PASSWORD=root Create Artisan Command Run the following artisan command on the terminal. php artisan make:command DatabaseBacku...
Share, Read & Learn