How to export SQL dump file of database via SSH
Posted: Thu Oct 13, 2022 12:56 pm
If you are logged in as 'root' in SSH, then run:
If you are not logged in as 'root' in SSH, then you need login credentials for database:
In order to run the said command, you will need to supply the following parameters:
To export only specific tables:
---
Here you can find how to IMPORT sql dump file to the database: viewtopic.php?t=612
Code: Select all
mysqldump database_name > data_dump.sql
Code: Select all
mysqldump -h localhost -u mysqlUsername --password='somepass' database_name > data_dump.sql
- hostname - it's localhost if you are dumping database from the same server
- mysqlUsername - The username for MySQL.
- password - The password of MySQL user.
- database_name - The name of the database you want to backup.
- data_dump.sql - The file name for your backup dump.
To export only specific tables:
Code: Select all
mysqldump database_name --tables table1 table2 table3 > data_dump.sql
Here you can find how to IMPORT sql dump file to the database: viewtopic.php?t=612