Can the file path for select into outfile be set on the client side?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: select into outfile文件路径是否可以设置在客户端

| username: TiDBer_4mYmoN9W

Can the file path for SELECT INTO OUTFILE be set on the client side?

| username: db_user | Original post link

It can only be exported to the corresponding TiDB server machine.

| username: caiyfc | Original post link

It is recommended to use dumpling for export.

| username: tidb菜鸟一只 | Original post link

No, and it’s more appropriate to use dumpling to export with TiDB.

| username: Jellybean | Original post link

  • In both MySQL and TiDB, executing select into outfile cannot directly export data to the local client machine; it can only be exported to the server where the database is located.
  • When TiDB executes, it exports the selected data to the TiDB server node that the user is connected to. If the user cannot access the machine or directory of that TiDB server node, they will not be able to retrieve the data.
    I hope the official team can optimize this scenario in future versions to improve user experience.
  • Currently, you can only use other logical backup tools, such as mysqldump, dumpling, dumper, etc., to export the data.
  • Alternatively, you can use shell commands like mysql --defaults-file=tidb-xx.cnf -Nse"select xxx" > xxx.txt to indirectly achieve local export.
| username: Raymond | Original post link

In MySQL, executing select into outfile can export data to the local machine, but TiDB behaves differently in this scenario. ----> MySQL also doesn’t allow this; it can only export to the machine where MySQL is located, not to the machine where the client is located, right?

| username: Jellybean | Original post link

Yes, you are right. I will adjust the comment content.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.