From c14900eb8e16162feabd2f6c9b6317c3d50e1e9f Mon Sep 17 00:00:00 2001 From: Patrick Canterino Date: Tue, 28 Dec 2021 12:58:06 +0100 Subject: [PATCH] Allow to define port for MySQL --- psmysqlbackup.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/psmysqlbackup.ps1 b/psmysqlbackup.ps1 index 77ba679..4e2a692 100644 --- a/psmysqlbackup.ps1 +++ b/psmysqlbackup.ps1 @@ -1,4 +1,5 @@ [String]$configMysqlHost = "localhost" +[Int32]$configMysqlPort = 3306 [String]$configMysqlUser = "backup" [String]$configMysqlPassword = "backup" @@ -9,14 +10,14 @@ [Int32]$configRotate = 7 function Get-Databases() { - $databaseString = (& $configMysqlCli --host=$configMysqlHost --user=$configMysqlUser --password=$configMysqlPassword --batch --skip-column-names -e "SHOW DATABASES;") + $databaseString = (& $configMysqlCli --host=$configMysqlHost --port=$configMysqlPort --user=$configMysqlUser --password=$configMysqlPassword --batch --skip-column-names -e "SHOW DATABASES;") $databases = $databaseString.split([Environment]::NewLine) return $databases } function Create-Backup([String]$database, [String]$target) { - & $configMysqldumpCli --host=$configMysqlHost --user=$configMysqlUser --password=$configMysqlPassword --single-transaction --result-file=$target $database + & $configMysqldumpCli --host=$configMysqlHost --port=$configMysqlPort --user=$configMysqlUser --password=$configMysqlPassword --single-transaction --result-file=$target $database } function Rotate-Backups($backupDir) { -- 2.34.1