Portal Home > Knowledgebase > MySQL and PostgreSQL > Export and import MySQL databases via SSH

Export and import MySQL databases via SSH

If you want to import your MySQL database through SSH on your VPS or dedicated server, use the following command:

mysql -u username -p database < file.sql

username – the username for the MySQL database, database – database name, file.sql - the file you want to include the MySQL dump.

After running the command you should enter the password for MySQL database, in case to complete the importing.

If you want to export MySQL database through SSH, use the following command:

mysqldump -u username -p database > file.sql


Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read

* Minimum sign up periods for cPanel Web Hosting plans: Mini - 3mo., Pro - 1mo., Biz - 1mo., cPanel Reseller Hosting, Linux VPS, Windows VPS, Managed cPanel VPS and Dedicated Servers - 1mo. secret link
Accepted payments: Credit/Debit Card, Paypal, Payza, Skrill, WebMoney, CashU, Ukash, paysafecard, Bitcoin, Perfect Money, SolidTrust Pay, OKPay, EgoPay, Western Union/MG, Wire Transfer and more.