1

My working server crashed, more precise, my HDD got bad sectors.
What is proper method to make a backup from non-working server and restore it later on newly installed server?

Any set of files I need to copy/replace?

Gacek
  • 1,181
  • 2
  • 9
  • 10

1 Answers1

2

You don't say which OS/Distro but in general

  • /etc/my.cnf
  • /etc/my.cnf.d/* (if it exists)
  • /var/lib/mysql/*

You may want to take a look at the config files after you have copied them from the disk to check that the datadir is correct.

user9517
  • 114,104
  • 20
  • 206
  • 289
  • It's Centos, dont remember if 6 or 7. I think 7. I assume /var;ib/mysql/* holds all database data, keys, indexes, schemas etc? – Gacek Feb 26 '17 at 21:46
  • 1
    That is the default datadir. – user9517 Feb 26 '17 at 21:46
  • 1
    Don't forget to `chown` recursively `/var/lib/mysql` content, importing this to your replacement instance. – SYN Feb 26 '17 at 21:53
  • Can't make image of partition. Currently `tar`ing all i Can. Haven't changed chown/chmod to files, but fired `tar` with `sudo tar`. hope it will have all privileges to copy files... – Gacek Feb 26 '17 at 21:57
  • 1
    *"Can't make image of partition."* That doesn't make sense. Use `dd_rescue`. – Michael - sqlbot Feb 27 '17 at 02:23