# "Error: datadir must be specified" while restoring full database backup

**URL:** <https://forums.percona.com/t/error-datadir-must-be-specified-while-restoring-full-database-backup/5226>\
**Category:** Percona XtraBackup\
**Created:** [November 23, 2016, 12:37am UTC](https://forums.percona.com/t/error-datadir-must-be-specified-while-restoring-full-database-backup/5226 "2016-11-23T00:37:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vaibhavvj](https://avatars.discourse-cdn.com/v4/letter/v/df788c/32.png) [@vaibhavvj](https://forums.percona.com/u/vaibhavvj)\
**Post date:** [November 23, 2016, 12:37am UTC](https://forums.percona.com/t/error-datadir-must-be-specified-while-restoring-full-database-backup/5226/1 "2016-11-23T00:37:38Z")

</div>

1. I am trying to restore backup using “innobackupex --copy-back /backup-path” but I get this output:  
##########  
161123 06:04:09 innobackupex: Starting the copy-back operation

IMPORTANT: Please check that the copy-back run completes successfully.  
At the end of a successful copy-back run innobackupex  
prints “completed OK!”.

innobackupex version 2.4.4 based on MySQL server 5.7.13 Linux (x86\_64) (revision id: df58cf2)  
Error: datadir must be specified.  
#########

My my.cnf file is not in /etc/my.cnf location but at some other location. So bascially innobackup is not able to read my.cnf file.  
When I create a soft link from /etc/my.cnf to my actual my.cnf file the backup works fine.

But otherwise it gives and error.  
I have also tried giving “–defaults-file=/path-to-my.cnf” which taking a the backup but it still doesnt work.  
Can someone tell me where does innobackupex read the configuration information from, while doing restore. The backup-my.cnf doesnt seem to have enough information in it.

1. I also get below line in the output of “innobackupex --apply-log”. Is that a normal?

###########  
InnoDB: The log sequence number 1631642 in the system tablespace does not match the log sequence number 30237230 in the ib\_logfiles!  
###########

I have attached my “backup” and “apply-log” outputs. I am new to Xtrabackup and am in the process of evaluating this for our company. Any help in this regard highly appreciated.

[innobkp apply log.txt](https://forums.percona.com/uploads/short-url/rgbyCAdXLdXUIXrgnGy1duLlROI.txt) (4.98 KB)

[innobkp backup log.txt](https://forums.percona.com/uploads/short-url/yjuEznUGtu0mPk4tEK8K6x8uaLh.txt) (17.7 KB)

---

<div class="post-metadata">

**Author:** ![miashaee](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@miashaee](https://forums.percona.com/u/miashaee)\
**Post date:** [February 16, 2017, 2:02pm UTC](https://forums.percona.com/t/error-datadir-must-be-specified-while-restoring-full-database-backup/5226/2 "2017-02-16T14:02:25Z")

</div>

I had the same error after updating to version 2.4.5, turns out it was a combination of two things:

1. You need to make sure that --defaults-file is listed first
2. I had to make sure that the filename for --defaults-file is “my.cnf” not “backup-my.cnf” or anything else, after that it worked.

example:

innobackupex --defaults-file=“/path-tofile/my.cnf” --copy-back /restore-target

Hope this helps, I couldn’t find anything online about that, and on the older version it didn’t matter what order you up the options in.
