Recover data from a crashed MySQL instance

Follow these steps to recover data from a crashed MySQL instance.


MySQL may crash due to file system errors or socket issues. Changing a Saleculator IP without stopping mysql service may also cause socket error. You need shell access to recover data from a crashed mysql instance.
If you don’t have shell access to Saleculator, see the section “Recovering using Clonezilla”

Connect a flash drive to Saleculator and type the below commands in shell. Press CTRL+ALT+F1 and CTRL+C to get access to shell.

mount /dev/sdb1 /flash
mkdir /flash/data
cp -rf /data/db /flash/data

You may copy the license file and configuration files also using below commands

cp /data/root/license.sig /flash/data
cp /data/root/Saleculator.properties /flash/data

Now reload Saleculator image in the device. After Saleculator image is successfully loaded, on the activation screen connect the flash drive, go to shell. Type the below commands to copy back the data:

remountrw
service mysql stop
rm -r /data/db
cp -rf /flash/data/db /data
cp /flash/data/license.sig /data/root/
cp /flash/data/Saleculator.properties /data/root/
rm /data/db/ib_log*
chown -R mysql:mysql /data/db/
service mysql start
mysqlcheck -u root -p SALECULATOR
reboot

Recovering using Clonezilla
Boot using Clonezilla live usb and get access to shell/cmd prompt. From the shell, issue below commands:

sudo -i
mkdir /flash
mount -t auto /dev/sda1 /flash (For Saleculator M4: mount -t auto /dev/mmcblk0p3 /flash)

Then copy folder /flash/db

0 Comments

Leave a Reply

Arrow-up