I am moving away from Linode because I don’t have the Linux sysadmin skills necessary; before I complete the transition to a more noob-friendly service, I need to export the contents of a MySQL database. Is there a way I can do this from the command line?
Share
You can accomplish this using the mysqldump command-line function.
For example:
If it’s an entire DB, then:
If it’s all DBs, then:
If it’s specific tables within a DB, then:
You can even go as far as auto-compressing the output using gzip (if your DB is very big):
If you want to do this remotely and you have the access to the server in question, then the following would work (presuming the MySQL server is on port 3306):
It should drop the
.sqlfile in the folder you run the command-line from.EDIT: Updated to avoid inclusion of passwords in CLI commands, use the
-poption without the password. It will prompt you for it and not record it.