Recover deleted db in a vps

Issues related to applications and software problems
Post Reply
radiotounsi
Posts: 1
Joined: 2017/05/19 09:55:53

Recover deleted db in a vps

Post by radiotounsi » 2017/05/19 11:00:42

Hi,
the directory var/log/mysql was mistakenly deleted and i dont have backup for it.
Is there a way to recover files ?
I am on a vps with centos 7

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Recover deleted db in a vps

Post by TrevorH » 2017/05/19 11:04:19

Not reliably. The longer you leave the system online and writing to the disk that was on, the more difficult and less reliable any recovery will be. If you have not restarted mysql then there may be a bodge where you can access the files that the server still has open but your best bet is to break out your backups and restore...
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

pjsr2
Posts: 614
Joined: 2014/03/27 20:11:07

Re: Recover deleted db in a vps

Post by pjsr2 » 2017/05/19 21:06:44

/var/log/mysql contains the log files for the mysql server. Just recreate the directory and restart the mysql daemon. You may only have lost some log messages. The transaction logs for the database, which contain crucial information for the database contents, are in the /var/lib/mysql directory. Also, your database files are in /var/lib/mysql. So, as long as you did not delete anything under the /var/lib/mysql directory, you shouldn't have lost any information that was stored in the database.

Post Reply