How to import/export mysql database via ssh

    You can import export mysql database via ssh follow the steps mentioned below 1. Login to ssh using ssh client putty or via (ubuntu)terminal 2. To export/Import use following commands
    mohit@mohitsharma.net$ mysqldump -h servername -u user -p dbname > dbname.sql
    Hit Enter (Prompted for database password)

    Enter password: <type password and enter passord not visible>

    mohit@mohitsharma.net$



    where servername =  localhost or the name or server
                user =  database username
                dbname = database name

    For import there is are two changes (> replaced by < and mysqldump with mysql) also please upload sql file in current directory

    mohit@mohitsharma.net$ mysql -h servername -u user -p dbname < dbname.sql
    Hit Enter (Prompted for database password)
    5
    Average: 5 (1 vote)