问题
How do i exact to my local machine?
select * into outfile 'C:\Info\table1.txt' fields terminated by ',' from table1;
This query creates under info folder as table1.txt on the server, how do i specify my local machine path here?
Thanks.
回答1:
You can't do it directly. The OUTFILE syntax only applies to the server itself. However, you can do :
c:\> mysql -u username -h nameofserver -p -e "SELECT ... FROM database.table WHERE ..." > c:\info\table1.txt
if you've configured MySQL to allow remote connections from your machine.
回答2:
This query creates under info folder as table1.txt on the server, how do i specify my local machine path here?
If you are accessing the remote machine using SSH, you can't, at least not directly. As far as I know, it is not possible to pipe the result of a INTO OUTFILE
operation.
Suggestions for workarounds:
Create a network share on your local machine that is reachable by the server (if possible)
Create a network share (or FTP account... or WebDAV account...) on the server, store the dump there and fetch it from there
来源:https://stackoverflow.com/questions/3755808/outfile-local-path-specification