Skip to content

Backup MySQL databases and gzip the output sql files. Using PowerShell script language for Windows.

License

Notifications You must be signed in to change notification settings

VanLex/MySql-Backup-Windows

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MySql-Backup-Windows

Backup MySQL databases and gzip the output sql files. Using PowerShell script language for Windows. Got the idea from mysql-backup-windows.bat.

Requirements

Setup

Download the github archive and extract to your script folder.

On mysqlbackup.ps1 file:

  • Change the value of the variable $cnfFile to the path to your my.cnf file.
  • Change the value of the variable $backupDir to the path to the folder where the backup files will be stored.
  • If required change the value of the variable $mysqldump to the path to mysqldump.exe file.
  • If required change the value of the variable $mysqlDataDir to the path to MySql data files directory. Is used to get only the names of the MySQL databases.
  • If required change the value of the variable $zip to the path to 7z.exe file.

On my.cnf file:

In section [client] change the user and password to your backup user. I recommend create user for backup with Limit to hosts Matching: localhost and Administrative Roles: BackupAdmin(Global Privileges: EVENT, LOCK TABLES, SELECT, SHOW DATABASES).

On Task Scheduler:

Сreate a task to run the mysqlbackup.ps1 script with the time necessary for you.

About

Backup MySQL databases and gzip the output sql files. Using PowerShell script language for Windows.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published