
Originally Posted by
cPanelTristan
You cannot copy the MySQL directory in /var/lib/mysql to another location in /var if you are running out of space and that is why it is being moved. If you copy it to /var/lib/mysql.old rather than move or copy it to /home or another partition with space, you'll definitely not have sufficient space in /var to make the copy and wind up with corrupted data. Thus, why we are recommending moving it to /home location. If you want to create both a copy in /home and then move it to /home, sure that would work, but a copy in /var doesn't work for space issues in that partition.
Also, simply using the cp command doesn't retain ownership on the copied files and will put the ownership to the root user you are using to perform the command, while mv will retain the file and folder permissions. If you copy to /home or anywhere else, you'll wind up with root owning it rather than mysql:mysql for the folders and files, and you'll have to fix the ownership if you copy it back to /var/lib/mysql again.