MySQL 按查询转储
是否可以通过单个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"
相关文章