mysql客户端在机子a上,server在机子b上。现在需要在a上远程查询b中的表,指定分隔符将表中的域分割,结果输出到a上的一个文件中。请问大侠们sql语句怎么写
试过这样的一个语句:
/usr/bin/mysql -uroot -p123456 -P5029 -h 10.11.200.79 -D ib_2012101724 -N -e"select * from cpc limit 1000 into outfile 'new' fields terminated by '\3'" 
但是new file是在远程机子上的

解决方案 »

  1.   

    试试mysqldump的这几个选项  --fields-terminated-by=name 
                          Fields in the output file are terminated by the given
                          string.
      --fields-enclosed-by=name 
                          Fields in the output file are enclosed by the given
                          character.
      --fields-optionally-enclosed-by=name 
                          Fields in the output file are optionally enclosed by the
                          given character.
      --fields-escaped-by=name 
                          Fields in the output file are escaped by the given
                          character.
      

  2.   

    /usr/bin/mysql -uroot -p123456 -P5029 -h 10.11.200.79 -D ib_2012101724 -N -e"select * from cpc limit 1000 " > new.txt
      

  3.   

    我看到的dump用法只有整张表往外导,现在要用sql语句限制