Restore custom mysql database from NS backup

NethServer Version: NethServer release 7.6.1810 (final)

Hello,

Does anyone knows how to restore the mysql database from NS backup?
We have a job management system called OneOrZero help desk which was installed in /var/lib/nethserver/vhost/ and I was able to restore the vhost folder, but the database didn’t restore during the restoration.
Now, I want to check the backup and see if it has been backed up and restore the database only for that OneOrZero.

Thanks

Regards,
Shiena

I think you need to restore this folder /var/lib/nethserver/backup/mysql. You can do it from Server Manager.

You will find you database files into /var/lib/nethserver/backup/mysql and you can restore them with mysqldump command, if I don’t make a mistake.
Move to /var/lib/nethserver/mysql with cd command.
If it’s only one file you need to use this command mysql < filename.sql to restore all databases.
If you can restore only one file use this command mysql --database=dbname < filename.sql

Wait for your feedback.
Regards.

2 Likes

Hello Federico,

Thanks for the location, that was correct and I restored the tickets.dump back.
image

I’m just wondering why the restored data is dated 20th Feb. 2019, even though the files on the NAS says I have a backup on the 23rd Feb. 2019.

Also, on the Restore files, I can only see the date as 25 Feb 2019 being the oldest. Is it something to do with the folder /var/lib/nethserver/backup/duplicity/backup-data/ after the restoration?

Thanks again

image

Probably the file of db wasn’t modify between 20 and 23 and incremental backup hasn’t copied it again.

The days on File Restore are saved on local cache. If you have reinstalled all the server I think it’s nomal you’ll see only days since server reinstallation. You can use CLI to go back more days.
https://nethserver.docs.nethesis.it/en/v7/backup.html#command-line-procedure

2 Likes

Thank you very much Federico.

I restored using the command:

restore-file -b backup-data -t 2D /tmp "/var/lib/nethserver/backup/mysql/tickets.dump"

and I was able to retrieve the backup dated 23 Feb 2019 which has the latest database before the server died.

Thanks again for your help.

1 Like

Please close this topic. Mark as solved.