Replication with Percona XtraBackup

Hi, community!
I’m trying to make a replication following this document How to set up a replica for replication in 6 simple steps with Percona XtraBackup - Percona XtraBackup. I have a lot questions about de files or paths that I need to use. The main question is what is the common path that I need to put when de document said /path/to/mysql/
Could give me someone a hand?

Hi @Antero_Najera
It’s basically datadir.
The document refers to /path/to/mysql/ as a placeholder for the actual location of your MySQL data directory on the server.

Generally, it would be /var/lib/mysql/, but to be sure about it you can check yours by following the command;

mysql> select @@datadir;
+-----------------+
| @@datadir       |
+-----------------+
| /var/lib/mysql/ |
+-----------------+
1 row in set (0.00 sec)
1 Like

Hi, yunus!
I really appreciate your help. Let me make couple questions more.
When the documentation says “mv /path/to/mysql/datadir /path/to/mysql/datadir_bak”, is it correct move all the information from this directory to backup directory inside of the same path?

For example:
mv /var/lib/mysql/ /var/lib/mysql/mysql_bkp

Following the document, the next step is move this directory but when I execute I got you need to give datadir.

xtrabackup --move-back --target-dir=/path/to/mysql/backupdir

So, my question is the target-dir = /var/lib/mysql/mysql_bkp and my datadir is again /var/lib/mysql/?

Again, thank you so much for your help!