I am working on refactoring an existing PHP project to use a web-framework. As part of the project, I needed some data in my local MySQL instance. This led to me learnginb about the export/import operations.
Approach: Use CLI.
SSH to the box that has the db.
Here is how to export the wbole schema:
$ mysqldump -d -u someuser -p mydatabase
.- Provide password at the prompt.
- Redirect ouput to a file as needed.
Here is how to export selective tables:
$ mysqldump -d -u someuser -p mydatabase table1 table2
.- Provide password at the prompt.
- Redirect ouput to a file as needed.
To export data as well, drop the -d
switch.
This excellent tutorial: https://www.electrictoolbox.com/mysqldump-schema-only/