Skip to content

Commit 7392384

Browse files
committed
added a port option for database to use defaults to 3306
1 parent b0b549a commit 7392384

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

config/dbsync.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
*/
2828
'username' => env('REMOTE_DATABASE_USERNAME', ''),
2929

30+
/*
31+
* Database port
32+
*/
33+
'port' => env('REMOTE_DATABASE_PORT', '3306'),
34+
3035
/*
3136
* Set the database name
3237
*/

src/Console/DbSyncCommand.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function handle(): bool
2727

2828
$username = config('dbsync.username');
2929
$database = config('dbsync.database');
30+
$port = config('dbsync.port');
3031
$password = config('dbsync.password');
3132
$ignore = config('dbsync.ignore');
3233
$ignoreTables = explode(',', $ignore);
@@ -48,9 +49,9 @@ public function handle(): bool
4849
}
4950

5051
if ($useSsh === true) {
51-
exec("ssh $sshUsername@$host -p$sshPort mysqldump -u $username -p$password $database $ignoreString > $fileName", $output);
52+
exec("ssh $sshUsername@$host -p$sshPort mysqldump --port$port -u$username -p$password $database $ignoreString > $fileName", $output);
5253
} else {
53-
exec("mysqldump -h$host -u $username -p$password $database $ignoreString --column-statistics=0 > $fileName", $output);
54+
exec("mysqldump -h$host --port$port -u$username -p$password $database $ignoreString --column-statistics=0 > $fileName", $output);
5455
}
5556

5657
$this->comment(implode(PHP_EOL, $output));

0 commit comments

Comments
 (0)