mysql - 查询远程数据库服务器时如何将 mysql OUTFILE 获取到客户端计算机

标签 mysql client file-io

当执行“select * from sometable into outfile 'c:/somefile.txt'”这样的语句时,如何在查询远程数据库服务器时将输出文件获取到客户端系统。是否有另一个命令可以实现这一点。有人可以给出完整的命令或步骤列表吗?提前致谢。

最佳答案

The SELECT ... INTO OUTFILE statement is intended primarily to let you very quickly dump a table to a text file on the server machine. If you want to create the resulting file on some other host than the server host, you normally cannot use SELECT ... INTO OUTFILE since there is no way to write a path to the file relative to the server host's file system.

However, if the MySQL client software is installed on the remote machine, you can instead use a client command such as mysql -e "SELECT ..." > file_name to generate the file on the client host.

来源:http://dev.mysql.com/doc/refman/5.0/en/select.html

关于mysql - 查询远程数据库服务器时如何将 mysql OUTFILE 获取到客户端计算机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6052058/

相关文章:

mysql - 从不同表的 2 列排序

c# - LINQ to SQL (NHibernate) : OrderBy vs OrderByDescending abstraction

delphi - 加载 SSL 模块失败。一个或多个映射方法不可用

tcp - 二进制协议(protocol)死了吗?

python - 打印语句仅出现在子进程调用之前或之后

java - Spring Boot native 查询抛出错误,但在mysql中有效

php - INSERT/UPDATE PHP 变量连同 SQL 中其他表的值

java - 如何使用服务器端代码在客户端计算机中创建和执行批处理文件?

c# - 获取 HttpPostedFileBase 的文件信息

java - 从 json 文件中读取多个元素