Recover mysql using data folder One of our MySQL servers died but somehow we were able to recover all the files from it. This server was a slave at one time however we stopped it being a slave so we could use it for housekeeping tasks and reports, etc.

Can someone tell me how to recover with this?

I now have these files and a backup of my.cnf

    ll /root/home/recovered/mysql/
    -rw-r----- 1 root root          117 Jun  1 09:30 rabney-relay-bin.000001
    -rw-r----- 1 root root           26 Jun  1 09:30 rabney-relay-bin.index
    -rw-r----- 1 root root 113055367168 Jun  1 10:42 ibdata1
    -rw-r----- 1 root root   1073741824 Jun  1 09:33 ib_logfile0
    -rw-r----- 1 root root   1073741824 Jun  1 09:33 ib_logfile1
    drwx------ 2 root root         4096 Jun  1 09:30 mysql
    drwx------ 2 root root        16384 Jun  1 09:30 production_copy
    -rw-r----- 1 root root   3253518648 Jun  1 09:32 slowquery.log
    drwx------ 2 root root         4096 Jun  1 09:30 test


I've been reading articles on Google regarding this but not sure how to do it yet.
STEP 01

Go see if MySQL is running on the Server. Run this

service mysql status


If the status says SUCCESS! MySQL running (some number) then shutdown mysql

service mysql stop


STEP 02

Run ls -l /etc/my.cnf. If the file exists, rename it with mv /etc/my.cnf /etc/my.cnf.backup

Then, copy your my.cnf into /etc

STEP 03

See if you have a previous mysql setup

ls -l /var/lib/mysql


If you do, do this

mv /var/lib/mysql /var/lib/mysql.old
mkdir /var/lib/mysql


Then, copy your /root/home/recovered/mysql into /var/lib/mysql

STEP 04

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


STEP 05

service mysql start


GIVE IT A TRY !!!