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,481
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

WMS Marketplace Seller
Joined
Dec 20, 2014
Messages
85
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,222
Replies
14
Views
5,654
Replies
10
Views
4,208
Latest threads
Replies
1
Views
80
Replies
1
Views
175
Replies
4
Views
383
Replies
11
Views
525
Replies
2
Views
228
Recommended threads
Replies
5
Views
4,457
Replies
26
Views
8,528
Replies
6
Views
3,977

Latest postsNew 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