• <legend id='fvCse'><style id='fvCse'><dir id='fvCse'><q id='fvCse'></q></dir></style></legend>
    • <bdo id='fvCse'></bdo><ul id='fvCse'></ul>

  • <tfoot id='fvCse'></tfoot>

      <small id='fvCse'></small><noframes id='fvCse'>

        <i id='fvCse'><tr id='fvCse'><dt id='fvCse'><q id='fvCse'><span id='fvCse'><b id='fvCse'><form id='fvCse'><ins id='fvCse'></ins><ul id='fvCse'></ul><sub id='fvCse'></sub></form><legend id='fvCse'></legend><bdo id='fvCse'><pre id='fvCse'><center id='fvCse'></center></pre></bdo></b><th id='fvCse'></th></span></q></dt></tr></i><div id='fvCse'><tfoot id='fvCse'></tfoot><dl id='fvCse'><fieldset id='fvCse'></fieldset></dl></div>

        在 MySQL 中找不到 outfile 创建的文件

        时间:2023-05-30
      1. <small id='4fpzG'></small><noframes id='4fpzG'>

        <legend id='4fpzG'><style id='4fpzG'><dir id='4fpzG'><q id='4fpzG'></q></dir></style></legend>
        <tfoot id='4fpzG'></tfoot>

        • <i id='4fpzG'><tr id='4fpzG'><dt id='4fpzG'><q id='4fpzG'><span id='4fpzG'><b id='4fpzG'><form id='4fpzG'><ins id='4fpzG'></ins><ul id='4fpzG'></ul><sub id='4fpzG'></sub></form><legend id='4fpzG'></legend><bdo id='4fpzG'><pre id='4fpzG'><center id='4fpzG'></center></pre></bdo></b><th id='4fpzG'></th></span></q></dt></tr></i><div id='4fpzG'><tfoot id='4fpzG'></tfoot><dl id='4fpzG'><fieldset id='4fpzG'></fieldset></dl></div>

              <tbody id='4fpzG'></tbody>

                  <bdo id='4fpzG'></bdo><ul id='4fpzG'></ul>
                  本文介绍了在 MySQL 中找不到 outfile 创建的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用以下查询来创建 CSV 文件

                  I am using the following query to create a CSV file

                  SELECT email INTO OUTFILE "mydata.csv"
                  FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
                  LINES TERMINATED BY "
                  "
                  FROM users;
                  

                  但是当我搜索 filezilla 时,我无法在任何地方找到 mydata.csv 文件.

                  But i am unable to find the mydata.csv file anywhere when i am searching through filezilla.

                  知道这个文件的存储位置吗?

                  Any idea where this file is getting stored?

                  查询运行成功,没有任何错误!有什么帮助吗?

                  The query runs successfully without any errors! Any Help?

                  推荐答案

                  MySQL 可能正在将文件写入自己的数据目录,例如 /var/lib/mysql/.要指定路径,请使用完整路径.

                  MySQL may be writing the file into its own data directory, like /var/lib/mysql/<databasename> for example. To specify the path, use a full path.

                  但是,它必须是运行 MySQL 服务器守护程序的用户帐户可写的目录.出于这个原因,我会经常使用 /tmp:

                  However, it must be a directory that is writable by the user account the MySQL server daemon is running under. For that reason, I'll often use /tmp:

                  指定要写入的路径,如下所示:

                  Specify the path you want to write to as in:

                  INTO OUTFILE '/tmp/mydata.csv'
                  

                  请注意,MySQL 会将文件写入 MySQL 服务器,而不是您的客户端计算机上.因此远程连接将在远程服务器上创建输出文件.另请参阅SELECT INTO OUTFILE local ?了解更多详情和解决方法.

                  And note that MySQL will write the file on the MySQL server, not on your client machine. Therefore remote connections will create output files on the remote server. See also SELECT INTO OUTFILE local ? for more details and workarounds.

                  关于在运行 systemd 的 Linux 系统上写入 /tmp 的注意事项:

                  最初发布此内容几年后,我发现自己无法通过

                  Some years after originally posting this, I found myself unable to locate a file written to /tmp via

                  ...INTO OUTFILE '/tmp/outfile.csv'
                  

                  在运行 Fedora Linux 和 systemd 的 MariaDB 5.5 服务器上.不是将文件直接写入指定的 /tmp/outfile.csv,而是在 /tmp 中的 systemd 目录下创建该目录和文件:

                  on a MariaDB 5.5 server running Fedora Linux with systemd. Instead of writing the file directly to /tmp/outfile.csv as specified, that directory and file were created beneath a systemd directory in /tmp:

                  /tmp/systemd-mariadb.service-XXXXXXX/tmp/outfile.csv
                  

                  虽然文件 outfile.csv 本身和 tmp/ 子目录都是可写的,但 systemd 服务目录本身有 700 个权限并且是 root 拥有的,需要 sudo 访问权限以检索其中的文件.

                  While the file outfile.csv itself and the tmp/ subdirectory were both created world-writable, the systemd service directory itself has 700 permissions and is root-owned, requiring sudo access to retrieve the file within it.

                  不是将 MariaDB 中的绝对路径指定为 /tmp/outfile.csv 并将其相对指定为 outfile.csv,而是按预期将文件写入 MariaDB 的数据中当前所选数据库的目录.

                  Rather than specifying the absolute path in MariaDB as /tmp/outfile.csv and specifying it relatively as outfile.csv, the file was written as expected into MariaDB's data directory for the currently selected database.

                  这篇关于在 MySQL 中找不到 outfile 创建的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:PHP 是否在文件处理程序被垃圾收集后关闭文件? 下一篇:如何在 PHP 中自动开始下载?

                  相关文章

                • <small id='Jvy54'></small><noframes id='Jvy54'>

                • <i id='Jvy54'><tr id='Jvy54'><dt id='Jvy54'><q id='Jvy54'><span id='Jvy54'><b id='Jvy54'><form id='Jvy54'><ins id='Jvy54'></ins><ul id='Jvy54'></ul><sub id='Jvy54'></sub></form><legend id='Jvy54'></legend><bdo id='Jvy54'><pre id='Jvy54'><center id='Jvy54'></center></pre></bdo></b><th id='Jvy54'></th></span></q></dt></tr></i><div id='Jvy54'><tfoot id='Jvy54'></tfoot><dl id='Jvy54'><fieldset id='Jvy54'></fieldset></dl></div>

                    <legend id='Jvy54'><style id='Jvy54'><dir id='Jvy54'><q id='Jvy54'></q></dir></style></legend>
                      <bdo id='Jvy54'></bdo><ul id='Jvy54'></ul>
                  1. <tfoot id='Jvy54'></tfoot>