Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to download the database dump from your live/test server

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.03k
    Comment on it

    Sometimes our requirement is to export/download the latest database from live/test server.

    We can easily create the dump on our server and then copy paste it from server to your local machine using Win-Scp.  
    But the issue comes when the size of our database becomes quite large, in that case we do not prefer copy-pasting it from sever to local because it may hamper your work.

     

    So best suggested way is to download it via browser by making that dump in a folder that is publicly accessible in your server & then using the downloadable link to directly download it from the browser.

     

    In Both test or live server you can follow the following steps to download it :

     

    1) login as root in your server using putty i.e:

    sudo -s

    2) create the dump of your database in the desired path. I am using mysql to create the dump:

    sudo mysqldump -u root -p***** testdb > folder1/testdb_dump.sql

    (Here **** will be your mysql passowrd, testdb is the name of the database whose dump is to be created, and testdb_dump.sql would be the dump that would be created for you.)

     

    3) In your server navigate to path where you have taken then dump using cd.

    $cd folder1

    4) Now we will compress this dump to shrink its size by using gzip

    gzip testdb_dump.sql

    5) Next step is to create the symlink of the zipped file in that folder on your server which is publicly accessible via browser.
        In my case say /var/www/test/images is publicly accessible then,

    ln -s testdb_dump.sql.gz /var/www/test/images/

    6) Once we create a symlink in the publicly accessible folder we can download the dump in following 2 ways :

     

       a) We can directly download it via browser by using domain name followed by the file name, i.e:

    abcd.com/testdb_dump.sql.gz

    (abcd.com would be replaced by your domain name)

     

      b) Or you can download it from your ubuntu terminal by using wget as :-

    sudo wget abcd.com/testdb_dump.sql.gz

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: