How to restore mysql Database from cpmove file through SSH

I have been asked a few times how to extract the mysql databases from cpmove cPanel files without extracting the full tar. 

tar -zxf navicosoftahostingcompany.tar.gz navicosoftahostingcompany/mysql;
mysql navicosoftahostingcompanydb < navicosoftahostingcompany/mysql/navicosoftahostingcompanydb.sql




If you want to create a for loop for achieving mysql databases from cpmove files, please use the following script to do so:


 for a in *;
do filenamewithonedot="${a%.*}";
filename="${filenamewithonedot%.*}"; 
tar -zxf $a $filename/mysql;mv $filename/mysql/*.* /home/abubakarsql/mysql --force;
echo $filename;
done;


Cheers!

Popular posts from this blog

How to Delete WHM Mail Queue through SSH sent from a particular sender

how to change witribe wlan password? how to secure your witribe router

How to Delete all logs in a cpanel server - SSH