5.4 Starting mysqld on a Restored Backup

After applying the log and creating the new ib_logfiles, we are ready to start mysqld on our backup database.

The backup database directory looks like this before we start mysqld. Note that the backup directory contains database subdirectories mysql, test, test115. These are not created by ibbackup, but they are created either manually by the user or automatically by the mysqlbackup command (see Chapter 7, mysqlbackup Command Reference).

$ ls -lh /sqldata-backups
total 872M
-rw-r-----    1 pekka    dev           41M Jan 22 15:33 ibbackup_logfile
-rw-r-----    1 pekka    dev          100M Jan 22 15:38 ibdata1
-rw-r-----    1 pekka    dev          200M Jan 22 15:38 ibdata2
-rw-r-----    1 pekka    dev          500M Jan 22 15:32 ibdata3
-rw-r-----    1 pekka    dev           10M Jan 22 15:40 ib_logfile0
-rw-r-----    1 pekka    dev           10M Jan 22 15:38 ib_logfile1
-rw-r-----    1 pekka    dev           10M Jan 22 15:38 ib_logfile2
drwxr-xr-x    2 pekka    dev          4.0k Jan 22 15:33 mysql
drwxr-xr-x    2 pekka    dev          4.0k Jan 22 15:33 test
drwxr-xr-x    2 pekka    dev          4.0k Jan 22 15:33 test115

We start mysqld on the backup database:

$ mysqld --defaults-file=/home/pekka/.backup-my.cnf
040122 15:41:57  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
040122 15:41:57  InnoDB: Starting log scan based on checkpoint at
InnoDB: log sequence number 0 646218252.
InnoDB: Doing recovery: scanned up to log sequence number 0 646218252
InnoDB: 2 transaction(s) which must be rolled back or cleaned up
InnoDB: in total 18 row operations to undo
InnoDB: Trx id counter is 0 239872
InnoDB: Starting rollback of uncommitted transactions
InnoDB: Rolling back trx with id 0 239533, 16 rows to undo
InnoDB: Rolling back of trx id 0 239533 completed
InnoDB: Rolling back trx with id 0 239532, 2 rows to undo
InnoDB: Rolling back of trx id 0 239532 completed
InnoDB: Rollback of uncommitted transactions completed
InnoDB: Last MySQL binlog file position 0 27183537, file name ./binlog.000005
040122 15:41:57  InnoDB: Flushing modified pages from the buffer pool...
040122 15:41:59  InnoDB: Started; log sequence number 0 646218252
040122 15:41:59  mysql.user table is not updated to new password format;
Disabling new password usage until mysql_fix_privilege_tables is run
mysqld: ready for connections.

Now mysqld is running on the restored backup database and ready to serve clients.

If you originally took the backup from a MySQL replication slave, then mysqld also prints the master database binlog position when you start mysqld on the backup.