是否可以通过单个SQL查询
来做mysqldump
?
Is it possible to do mysqldump
by single SQL query
?
我的意思是转储整个数据库,就像phpmyadmin
在导出到SQL
I mean to dump the whole database, like phpmyadmin
does when you do export to SQL
不是mysqldump,而是mysql cli...
not mysqldump, but mysql cli...
mysql -e "select * from myTable" -u myuser -pxxxxxxxxx mydatabase
如果需要,您可以将其重定向到文件:
you can redirect it out to a file if you want :
mysql -e "select * from myTable" -u myuser -pxxxxxxxx mydatabase > mydumpfile.txt
更新:原始帖子询问他是否可以通过查询从数据库中转储.他问的和他的意思是不同的.他真的很想 mysqldump 所有表.
Update: Original post asked if he could dump from the database by query. What he asked and what he meant were different. He really wanted to just mysqldump all tables.
mysqldump --tables myTable --where="id < 1000"
这篇关于MySQL 按查询转储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!