[SOLVED] Having trouble with restoration

Hi,

I am planning to use XtraBackup on production mysql servers but so far I am having trouble performing a successfull backup / restore.

The backup seems to go okay. I have tried the following commands for the backup:

innobackupex --user=root --password=supercoolpass-- /tmp/backup/

Everything seems to go okay:

innobackupex: Backup created in directory '/tmp/backup/2012-01-29_19-42-54’innobackupex: MySQL binlog position: filename ‘’, position120129 19:43:18 innobackupex: completed OK!

Now when I try to perform a restoration, the following happens:

innobackupex --copy-back /tmp/backup/2012-01-29_19-42-54/InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oyand Percona Inc 2009-2011. All Rights Reserved.This software is published underthe GNU GENERAL PUBLIC LICENSE Version 2, June 1991.IMPORTANT: Please check that the copy-back run completes successfully. At the end of a successful copy-back run innobackupex prints “completed OK!”.Original data directory is not empty! at /usr/bin/innobackupex line 503.

So I did some (a lot of) reading and found that ‘ls /var/lib/mysql/’ must return empty’, and I tried the following:

[root@ip ~]# /etc/init.d/mysqld stop[root@ip ~]# mkdir /tmp/mysql[root@ip ~]# mv /var/lib/mysql/* /tmp/mysql/[root@ip ~]# ls /var/lib/mysql[root@ip ~]#

Now when I run the restoration, it appears to work:

[root@ip-10-0-1-4 ~]# innobackupex --copy-back /tmp/backup/2012-01-29_19-42-54/InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oyand Percona Inc 2009-2011. All Rights Reserved.This software is published underthe GNU GENERAL PUBLIC LICENSE Version 2, June 1991.IMPORTANT: Please check that the copy-back run completes successfully. At the end of a successful copy-back run innobackupex prints “completed OK!”.innobackupex: Starting to copy MyISAM tables, indexes,innobackupex: .MRG, .TRG, .TRN, .ARM, .ARZ, .CSM, .CSV, .opt, and .frm filesinnobackupex: in '/tmp/backup/2012-01-29_19-42-54’innobackupex: back to original data directory ‘/var/lib/mysql’–ommitted—innobackupex: Finished copying back files.

But now MySQL will not start:

[root@ip-10-0-1-4 ~]# /etc/init.d/mysqld startMySQL Daemon failed to start.Starting mysqld: [FAILED]

So, what am I doing wrong?

Cheers!

First make sure that the data is actually in /var/lib/mysql as intended, and if it is, make sure it is owned by MySQL. If it is not, MySQL will not start properly.

chown -R mysql:mysql /var/lib/mysql/

Hi,

Yes I forgot to reply. I noticed the files were owned by root so I chown’d them and it starts now.

/var/lib/mysql is the data directory; however, I setup a symbolic link to /mnt/raid/mysql. Could this be the reason why the script didn’t do it? Or is chown-ing part of the standard recovery procedure?