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%.*}";
tar -zxf $a $filename/mysql;mv $filename/mysql/*.* /home/abubakarsql/mysql --force;
echo $filename;


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

SOLVED: WHM/CPANEL Your server does not support the connection encryption type you have specified. Try changing the encryption method