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,541
Replies
14
Views
6,320
Replies
10
Views
4,831
Latest threads
Replies
2
Views
394
Replies
1
Views
370
Replies
4
Views
1,891
Replies
3
Views
797
Recommended threads
Replies
4
Views
3,182
Replies
4
Views
2,135

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