Restoring backup problems. No databases

Hello,
I have to set up a backup strategy, so I’ve made a lot of researches and the best one for my objectifs is XtraBackup.
So I am testing it locally on a Ubuntu 12.04 and Mysql 5.5.31. I’m backuping and restoring on the same server.
I have read the whole documentation and I’m doing the following (I’m using sudo because I’ve no rights to write in /opt, after everything works I’ll put this commands in a sh file and without sudo, maybe this could be the error) :

backup:
sudo innobackupex --user=xxx --password=xxx /opt/backups/full

output :
innobackupex: Backup created in directory ‘/opt/backups/full/2013-06-20_14-12-23’
130620 14:13:20 innobackupex: Connection to database server closed
130620 14:13:20 innobackupex: completed OK!

prepare :
sudo innobackupex --apply-log --user=xxx --password=xxx /opt/backups/full

output :
xtrabackup: starting shutdown with innodb_fast_shutdown = 1
130620 14:15:26 InnoDB: Starting shutdown…
130620 14:15:30 InnoDB: Shutdown completed; log sequence number 267572236
130620 14:15:30 innobackupex: completed OK!

sudo /etc/init.d/mysql stop
sudo rm -rf /var/lib/mysql ( if I do a sudo rm -rf /var/lib/mysql/* the data still there so I’m deleting the directory )
sudo mkdir /var/lib/mysql
sudo chown -R mysql:mysql /var/lib/mysql

restoring
sudo innobackupex --copy-back --user=xxx --password=xxx /opt/backups/full/2013-06-20_14

output :
innobackupex: Finished copying back files.

130620 14:23:41 innobackupex: completed OK!

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

sudo /etc/init.d/mysql start

Everything works fine but in phpmyadmin or when I connect on mysql, there is no databases.

I dont know if I have missed a configuration…

I hope that someone have a solution, I’ll continue to search and report it here if I found a fix for my problem.
In the log file I’ve got this :

#/var/log/mysql/error.log

InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
130620 14:22:51 InnoDB: Unable to open the first data file
InnoDB: Error in opening ./ibdata1
130620 14:22:51 InnoDB: Operating system error number 11 in a file operation.
InnoDB: Error number 11 means ‘Resource temporarily unavailable’.
InnoDB: Some operating system error numbers are described at
InnoDB: [url]http://dev.mysql.com/doc/refman/5.5/en/operating-system-error-codes.html[/url]
130620 14:22:51 InnoDB: Could not open or create data files.
130620 14:22:51 InnoDB: If you tried to add new data files, and it failed here,
130620 14:22:51 InnoDB: you should now edit innodb_data_file_path in my.cnf back
130620 14:22:51 InnoDB: to what it was, and remove the new ibdata files InnoDB created
130620 14:22:51 InnoDB: in this failed attempt. InnoDB only wrote those files full of
130620 14:22:51 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
130620 14:22:51 InnoDB: remove old data files which contain your precious data!
130620 14:22:51 [ERROR] Plugin ‘InnoDB’ init function returned error.
130620 14:22:51 [ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.
130620 14:22:51 [ERROR] Unknown/unsupported storage engine: InnoDB
130620 14:22:51 [ERROR] Aborting

130620 14:22:51 [Note] /usr/sbin/mysqld: Shutdown complete

130620 14:24:18 InnoDB: Starting shutdown…
130620 14:24:19 InnoDB: Shutdown completed; log sequence number 267572236
130620 14:24:19 [Note] /usr/sbin/mysqld: Shutdown complete

130620 14:24:19 [Note] Plugin ‘FEDERATED’ is disabled.
130620 14:24:19 InnoDB: The InnoDB memory heap is disabled
130620 14:24:19 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130620 14:24:19 InnoDB: Compressed tables use zlib 1.2.3.4
130620 14:24:19 InnoDB: Initializing buffer pool, size = 128.0M
130620 14:24:19 InnoDB: Completed initialization of buffer pool
130620 14:24:19 InnoDB: highest supported file format is Barracuda.
130620 14:24:19 InnoDB: Waiting for the background threads to start
130620 14:24:20 InnoDB: 5.5.31 started; log sequence number 267572236
130620 14:24:20 [Note] Server hostname (bind-address): ‘127.0.0.1’; port: 3306
130620 14:24:20 [Note] - ‘127.0.0.1’ resolves to ‘127.0.0.1’;
130620 14:24:20 [Note] Server socket created on IP: ‘127.0.0.1’.
130620 14:24:20 [ERROR] Can’t start server: Bind on TCP/IP port: Address already in use
130620 14:24:20 [ERROR] Do you already have another mysqld server running on port: 3306 ?
130620 14:24:20 [ERROR] Aborting

130620 14:24:22 InnoDB: Starting shutdown…
130620 14:24:22 InnoDB: Shutdown completed; log sequence number 267572236
130620 14:24:22 [Note] /usr/sbin/mysqld: Shutdown complete

130620 14:24:45 [Note] Plugin ‘FEDERATED’ is disabled.
130620 14:24:45 InnoDB: The InnoDB memory heap is disabled
130620 14:24:45 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130620 14:24:45 InnoDB: Compressed tables use zlib 1.2.3.4
130620 14:24:45 InnoDB: Initializing buffer pool, size = 128.0M
130620 14:24:45 InnoDB: Completed initialization of buffer pool
130620 14:24:45 InnoDB: highest supported file format is Barracuda.
130620 14:24:45 InnoDB: Waiting for the background threads to start
130620 14:24:46 InnoDB: 5.5.31 started; log sequence number 267572236
130620 14:24:46 [Note] Server hostname (bind-address): ‘127.0.0.1’; port: 3306
130620 14:24:46 [Note] - ‘127.0.0.1’ resolves to ‘127.0.0.1’;
130620 14:24:46 [Note] Server socket created on IP: ‘127.0.0.1’.
130620 14:24:46 [ERROR] Can’t start server: Bind on TCP/IP port: Address already in use
130620 14:24:46 [ERROR] Do you already have another mysqld server running on port: 3306 ?
130620 14:24:46 [ERROR] Aborting

130620 14:24:46 InnoDB: Starting shutdown…
130620 14:24:47 InnoDB: Shutdown completed; log sequence number 267572236
130620 14:24:47 [Note] /usr/sbin/mysqld: Shutdown complete

130620 14:24:47 [Note] Plugin ‘FEDERATED’ is disabled.
130620 14:24:47 InnoDB: The InnoDB memory heap is disabled
130620 14:24:47 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130620 14:24:47 InnoDB: Compressed tables use zlib 1.2.3.4
130620 14:24:47 InnoDB: Initializing buffer pool, size = 128.0M
130620 14:24:47 InnoDB: Completed initialization of buffer pool
130620 14:24:47 InnoDB: highest supported file format is Barracuda.
130620 14:24:47 InnoDB: Waiting for the background threads to start
130620 14:24:48 InnoDB: 5.5.31 started; log sequence number 267572236
130620 14:24:48 [Note] Server hostname (bind-address): ‘127.0.0.1’; port: 3306
130620 14:24:48 [Note] - ‘127.0.0.1’ resolves to ‘127.0.0.1’;
130620 14:24:48 [Note] Server socket created on IP: ‘127.0.0.1’.
130620 14:24:48 [ERROR] Can’t start server: Bind on TCP/IP port: Address already in use
130620 14:24:48 [ERROR] Do you already have another mysqld server running on port: 3306 ?
130620 14:24:48 [ERROR] Aborting

If I restart Ubuntu, all databases are appearing.

Mirza,

When you stopped mysql after prepare stage. It was clean shutdown ? My assumption is mysqld was not stopped cleanly.
Error log points that too.
[ERROR] Can’t start server: Bind on TCP/IP port: Address already in use
[ERROR] Do you already have another mysqld server running on port: 3306 ?
[ERROR] Aborting

Further, when you started mysqld after copy-back does it started OK or it fails to start ?

Thank you for the response.
You were right, mysql doesn’t stoped correctly.
Now I use the command service mysql stop and it works fine.

Can I ask you a second question ?
I’ll setup an incremental backuping to save bandwith. I made no changes on the databases and i’ve made an incremental backup, the size of the folder is the half of the full backup ( full = 660Mo, incremental with no changes = 300Mo). Is there an option for getting only the diff in incremental.