MySQL通过查询转储 [英] MySQL dump by query

查看:99
本文介绍了MySQL通过查询转储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过单个 SQL查询 mysqldump

我的意思是转储整个数据库,如 phpmyadmin code>

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通过查询转储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆