2

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.

  • Questions : 1) Do you have anything in /var/lib/mysql right now ? 2) Do you have an existing /etc/my.cnf ? – RolandoMySQLDBA Jul 31 '15 at 15:07
  • No. Its a new server. So I just installed mysql. – ajsdg Jul 31 '15 at 15:41
  • Is there a /var/lib/mysql folder with similar contents ??? – RolandoMySQLDBA Jul 31 '15 at 15:42
  • no. There is no /var/lib/mysql. I was wondering if I should create a /var/lib/mysql and copy all files from /root/home/recovered/mysql to this new directory and also replace my.cnf with the backup copy and then try to start mysql server? will that work? – ajsdg Jul 31 '15 at 15:57
0

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 !!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.