Is copying /var/lib/mysql a good alterntive to mysqldump?

JohnASimpleWorld

New member
Joined
Jul 10, 2015
Messages
11
Points
0
I am planning to make a full backup of my entire Centos system, I was thinking if I have a copy of /var/lib/mysql directory is a good way to backup all my databases.

are all informations needed contained in that directory?
can there be problems while restoring those files on a new VPS server?
All my database will be restored without using any tools?
 

Rob Whisonant

Moderator
Joined
May 24, 2016
Messages
2,489
Points
113
Yes it will work but I would shut down MySQL first. Then do the backup. Then restart MySQL. Also make sure if you do copy the folder to a new server that it is running the same version of MySQL as the one you backed it up from.
 

Dewlance

Member
Joined
Dec 20, 2014
Messages
91
Points
8
Problem I face with MySQL-Dump, It does not take backup of corrupt data so If we will take backup using mysqldump and try to restore on new server then it will be possible that many of database will be not restored.

But with copying /var/lib/mysql directory, It will restore data as it is and nothing will be lost. You can repair corrupt data.


As suggested by Rob Whisonant, Always shutdown MySQL/MariaDB server before taking a backup of directory else data can be lost.
 
Newer threads
Replies
5
Views
2,558
Replies
14
Views
6,354
Replies
10
Views
4,887
Latest threads

Referral contests

Referral link for :

Sponsors

Popular tags

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top