I needed dump some data from a restored ibdata file on a production server. In order to do this, a second instance of mysql was started with a separate data directory. Here are the steps to make it happen.

1. Create a new data directory.

mkdir /var/lib/mysql2

2. Install the base mysql server files.

mysql_install_db –datadir=/var/lib/mysql2/

3. Copy the ibdata file AND the database directory to /var/lib/mysql2.

cp ibdata /var/lib/mysql2; cp -a [db_directory] /var/lib/mysql2

4. Make sure mysql is the owner of the directory and the files.

chown -R mysql.mysql /var/lib/mysql2

5. Change to /var/lib/mysql2

cd /var/lib/mysql2

6. In a screen session, start up a second instance of mysql and connect it to a socket.

/usr/libexec/mysqld –datadir=$PWD –log-error=innodb_recovery.log –skip-slave-start –skip-log-bin –socket=mysql.sock –port=3307user=mysql

If you have problems connecting to mysql, check the innodb_recovery.log file to see what errors you are getting.

7. Detach from the screen session.

ctrl-a ctrl-d

8. While in /var/lib/mysql2, dump the database(s) you need.

mysqldump -p -Smysql.sock –databases [database_name] > [dump_file].sql

9. Shut down the second instance of mysql.

mysqladmin -p -Smysql.sock shutdown

That's it! You should have a dump file(s) with your data in it. How you use it from this point is up to you.