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

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

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

        不允许在文件中加载数据 MariaDB

        load data infile is not allowed MariaDB(不允许在文件中加载数据 MariaDB)
        <legend id='Ukz0X'><style id='Ukz0X'><dir id='Ukz0X'><q id='Ukz0X'></q></dir></style></legend>
          • <bdo id='Ukz0X'></bdo><ul id='Ukz0X'></ul>

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

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

                    <tbody id='Ukz0X'></tbody>
                  本文介绍了不允许在文件中加载数据 MariaDB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我创建了一个 PHP 脚本,可将 CSV 文件中的帖子导入 WordPress 网站.

                  为此,我首先将帖子批量导入 WP 网站数据库的表中,然后 PHP 脚本创建帖子.我使用的批量插入 MYSQL 查询如下:

                  将数据本地 infile '/var/www/vhosts/sitenamehere.test/test.csv' 加载到表 test_table 字符集 latin1 字段中以 ';' 结尾以 '
                  ' 结尾的行忽略 1 行;

                  当我从服务器运行脚本时,出现以下错误:

                  <块引用><块引用>

                  此 MariaDB 版本不允许使用的命令用于查询加载数据本地 infile..."

                  只有当我从服务器执行脚本时才会出现问题,事实上,如果我从 phpMyAdmin 运行相同的查询,它可以让我导入文件.

                  由于我的脚本不仅导入而且更新帖子,其目的是创建一个 cron 作业,以便脚本每天执行多次.如果我不断收到同样的错误,显然这是不可能的.

                  我尝试添加:

                  • my.cnf的[client][mysqld]部分下的local-infile=1代码>
                  • [mysql] 部分下的 mysql.allow_local_infile=Onmy.cnf
                  • 位于 /opt/plesk 的 php.ini[MySQLi] 部分下的 mysql.allow_local_infile=On 行/php/7.1/etc

                  但没有任何帮助.有什么想法吗?

                  解决方案

                  当您想要加载本地文件时,必须将 AllowLoadLocalInfile=true; 添加到您的 MySQL/MariaDB 服务器连接字符串.p>

                  如果使用类似 LOAD LOCAL INFILE 命令的内容,则将 --local_infile=1 添加到命令本身,它应该可以工作.

                  在两个服务器的最新版本中,此功能默认禁用,仅应在必要时启用.

                  I created a PHP script that imports posts from a CSV file into a WordPress website.

                  To do this, I first bulk import the posts into a table of the WP website database and then the PHP script creates the posts. The bulk insert MYSQL query I use is the following:

                  load data local infile '/var/www/vhosts/sitenamehere.test/test.csv' into table test_table character set latin1 fields terminated by ';' lines terminated by '
                  ' ignore 1 lines;
                  

                  When I run the script from the server I get the following error:

                  "the used command is not allowed with this MariaDB version for the query load data local infile..."

                  The problem occurs only when I execute the script from the server, in fact if I run the same query from phpMyAdmin, it lets me import the file.

                  Since my scripts not only imports but also updates posts, the intention was to create a cron job so that the script is executed multiple times a day. Obviously this is not possible if I keep getting the same error.

                  I tried adding:

                  • the line local-infile=1 under the section [client] and [mysqld] of my.cnf
                  • the line mysql.allow_local_infile=On under the [mysql] section of my.cnf
                  • the line mysql.allow_local_infile=On under the [MySQLi] section of php.ini located at /opt/plesk/php/7.1/etc

                  But nothing helped. Any ideas?

                  解决方案

                  You must add AllowLoadLocalInfile=true; to your MySQL/MariaDB server connection string when you want to load a local file.

                  If using something like a LOAD LOCAL INFILE command then add --local_infile=1 to the command itself and it should work.

                  In recent versions of both servers this functionality is disabled by default and should only be enabled when necessary.

                  这篇关于不允许在文件中加载数据 MariaDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

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

                  <legend id='mCmX0'><style id='mCmX0'><dir id='mCmX0'><q id='mCmX0'></q></dir></style></legend>

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

                            <tfoot id='mCmX0'></tfoot>