Posts filed under SSH

How to upload and install huge SQL files through SSH in CentOS?

Filed in LinuxTags: , , , ,

This is a very general problem for the people who maintains the large websites. The problem comes generally when need to move website it to another server . Even I used to do it manually through phpmyadmin page and then import in my early days. But this method has limitations. If you are looking for some other way to do it quickly then this information is for you .

Requirements : You must have SSH access for the new server , must have PV installed on it. If not then ask your hosting provider to install it for you or you can install it yourself if you have root access.

First copy the DB file from OLD server to new using sftp .

First install pv (Pipe Viewer)  run command

IN CentOS/Fedora

install yum pv


apt-get install pv


Browse to the SQL file and then run the below command (Replace HugeFile with your SQL file name )

 pv HugeFile.mysql.sql.gz | gunzip | mysql -u username -p database

The above command will prompt for DB password . It will start and will show the progress of installation

Leave comments below if y