From: Patrick Canterino Date: Tue, 28 Dec 2021 11:58:06 +0000 (+0100) Subject: Allow to define port for MySQL X-Git-Tag: 0.1~17 X-Git-Url: https://git.p6c8.net/psmysqlbackup.git/commitdiff_plain/c14900eb8e16162feabd2f6c9b6317c3d50e1e9f?ds=inline Allow to define port for MySQL --- 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) {