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 download the contents of a MySQL database. Is there a way I can do this from the command line?
相关问题
- sqlyog export query result as csv
- NOT DISTINCT query in mySQL
- MySQL: conduct a basic search
- Why sometimes there is one of more gap(s) in the v
- mySQL alter table on update, current timestamp
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
.sql
file in the folder you run the command-line from.EDIT: Updated to avoid inclusion of passwords in CLI commands, use the
-p
option without the password. It will prompt you for it and not record it.In latest versions of mysql, at least in mine, you cannot put your pass in the command directly.
You have to run:
mysqldump -u [uname] -p db_name > db_backup.sql
and then it will ask for the password.
On windows you need to specify the mysql bin where the mysqldump.exe resides.
save this into a text file such as backup.cmd
Just type
mysqldump
ormysqldump --help
in your cmd will showhow to use
Here is my cmd result