Outfile local path specification
How do i exact to my local machine?
select * into outfile 'C:\Info开发者_JS百科\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.
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.
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
精彩评论