1. Go to this page and download the library: Download n3xt0r/laravel-mysql-sync library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
return [
/*
|--------------------------------------------------------------------------
| Remote Server Connections
|--------------------------------------------------------------------------
|
| These are the servers that will be accessible via the SSH task runner
| facilities of Laravel. This feature radically simplifies executing
| tasks on your servers, such as deploying out these applications.
|
*/
'connections' => [
'production' => [
'host' => 'example.com',
'username' => 'myUser',
'password' => '',
'key' => storage_path('id_rsa'),
'keytext' => '',
'keyphrase' => '',
'agent' => '',
'timeout' => 10,
],
],
/*
|--------------------------------------------------------------------------
| Remote Server Databases
|--------------------------------------------------------------------------
|
| These are the databases that will be accessible for syncing.
|
*/
'databases' => [
'laravel' => [
'connection' => 'production',
'host' => 'mysql.example.com',
'database' => 'myApp',
'user' => 'root',
'password' => 'myPassword',
],
'secondOptionalDb' => [
'connection' => 'production',
'host' => 'mysql.example.com',
'database' => 'customerDb',
'user' => 'root',
'password' => 'myPassword',
],
],
'environments' => [
'production' => [
/**
* be careful, this is the same order like on importing databases
* when you have constraints between database, set them to correct order.
*/
'databases' => [
'laravel',
'secondOptionalDb',
],
],
],
/**
* originally it should be the storage dir
* but you could configure any other directory, too.
*/
'storage' => storage_path(),
];