For using mysqlhotcopy the database user must have RELOAD privilege. To set this we need root access of database.
[root@server]# mysql -u root -p
Enter password :
mysql > grant reload on *.* to <user_name>;
mysql > \q
There are two options for mysqlhotcopy. “allowold” and “keepold”
–keepold : keeps two copy of backup. One is <databasename> and other one is <databasename_old>
–allowold : keeps only one copy of backup.
Backup using mysqlhotcopy
[root@server]# mysqlhotcopy –host <host_name> –user <user_name> –password <password> <database_name> <path_to_new_directory> –allowold/–keepold
Restore from backup
To restore database from backup, first you need to stop mysql server. Then just copy database directory from backup path to /var/lib/mysql/ (this is the default path) directory. Please make sure that mysql is stopped before you start the restore.