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!
0 Comments