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

 

  • 122 Els usuaris han Trobat Això Útil
Ha estat útil la resposta?

Articles Relacionats

Can I connect to MySQL from my computer

Yes, you can. Just need to add your IP address in the hosts allowed to connect to MySQL. Adding...

Can’t connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

If you receive this error message when connecting to MySQL trough command line on your VPS...

Export and import of MySQL databases from cPanel

For management on databases in your hosting account you can use the web application phpMyAdmin....

How to see the MySQL variables

Log into your MySQL database and type: show variables; You will see the following: mysql>...

Optimization and repair of MySQL database

If you have suspicions that the MySQL database is running slowly or appear errors, you need to...