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,652
Replies
10
Views
4,205
Latest threads
Replies
1
Views
75
Replies
1
Views
174
Replies
4
Views
380
Replies
11
Views
523
Replies
2
Views
228
Recommended threads
Replies
2
Views
3,284
Replies
3
Views
1,934
Replies
20
Views
11,183

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