Where the open source database community meets: Use code PERCONA75 and secure your spot for Percona Live.  Register

Running Percona XtraBackup on Windows … in Docker

March 20, 2017
Author
Vadim Tkachenko
Share this Post:

Percona XtraBackupIn this blog, we’ll look at running Percona XtraBackup on Windows via a Docker container.

The question whether Percona XtraBackup is available for Windows comes up every so often. While we are not planning to provide regular releases for Windows, I decided to share a way to run Percona XtraBackup in a Docker container (especially since Docker support for Windows has become more and more stable).

For this exercise, I created a playground Docker image: perconalab/percona-xtrabackup.

First, we need to prepare a few things to make it work:

  1. Install Docker on Windows (the current version I am running is 17.03)
  2. Enable the sharing of disk C in Docker settings
  3. Find out the IP address MySQL is running on (192.168.1.122 in my case)
  4. Grant backup-required privileges for the xtrabackup user:

GRANT RELOAD,PROCESS,LOCK TABLES,REPLICATION CLIENT ON *.* TO 'xtrabackup'@'192.%' IDENTIFIED by 'xtrapassword'

Now, let’s assume our datadir is in C:/mysqldata, and we want to backup to C:/mysqlbackup. Needless to say, that XtraBackup image must run on the same server as MySQL’s datadir (since XtraBackup needs to access the data to copy it).

Now to take a backup we execute:

docker run --rm -it -v //C/mysqldata:/var/lib/mysql -v //C/mysqlbackup:/xtrabackup_backupfiles perconalab/percona-xtrabackup --backup --host=192.168.1.122 --user=xtrabackup --password=xtrapassword

We find our backup in C:/mysqlbackup when it is done.

Enjoy!

0 0 votes
Article Rating
Subscribe
Notify of
guest

9 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Peter Laursen
9 years ago

I was able to install XtraBackup on “bash in Windows” directly/natively from Ubuntus repository (“sudo apt-get install ..” or use “Synaptic” GUI softare management tool). But I haven’t tested if it works. Have you?

If you don’t know “bash in Windows” you can start here:
https://blog.webyog.com/how-to-add-a-gui-to-the-new-bash-console-in-windows-10/

Peter Laursen
9 years ago

It does not seem so:

C:Usersjazcy>bash
peter@SH-WIN10:/mnt/c/Users/jazcy$ xtrabackup –user=root –password=secret -host=127.0.0.1 –port=3308 –backup –target-dir=test
prctl() failed with errno = 22
peter@SH-WIN10:/mnt/c/Users/jazcy$

No diference if I install rpctl. Maybe “bash in Windows” will not be allowed to get the information from the system it needs or rpctl is simply incompatible with Windows and not translated to Windows system calls on this environment . It would be nice to avoid Docker, so if there is a solution it would be nice

Thoughts?

Peter Laursen
9 years ago

correction. no diference if I install prctl

LongFly
LongFly
7 years ago

Is incremental backup supported?

Amine
Amine
6 years ago

PS C:UsersDell> docker run –rm -it -v //C//DATA:/var/lib/mysql -v //C/mysqlbackup:/xtrabackup_backupfiles perconalab/percona-xtrabackup –backup –host=localhost –user=xtrabackup –password=xtrapassword
Unable to find image ‘perconalab/percona-xtrabackup:latest’ locally
C:Program FilesDockerDockerResourcesbindocker.exe: Error response from daemon: Get https://registry-1.docker.io/v2/perconalab/percona-xtrabackup/manifests/latest: unauthorized: incorrect username or password.
See ‘C:Program FilesDockerDockerResourcesbindocker.exe run –help’.

can you help me please

Far
Enough.

Said no pioneer ever.
MySQL, PostgreSQL, InnoDB, MariaDB, MongoDB and Kubernetes are trademarks for their respective owners.
© 2026 Percona All Rights Reserved