• ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement


    使用load data导入数据时

    mysql> load data infile '/myshare/area_info.txt' into table area_info;
    ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
    mysql> show variables like '%secure_file%';
    +------------------+-------+
    | Variable_name    | Value |
    +------------------+-------+
    | secure_file_priv | NULL  |
    +------------------+-------+
    1 row in set (0.00 sec)
    
    secure_file_prive=null   -- 限制mysqld不允许导入导出
    secure_file_priv=/tmp/   -- 限制mysqld导入导出只能发生在/tmp/目录下
    secure_file_priv=''      -- 不对mysqld导入导出做限制
    View Code

    此时需要修改配置文件my.cnf,[mysqld]下添加secure_file_priv='' ,重启数据库服务

    #导入
    mysql> load data infile '/myshare/area_info.txt' into table area_info fields terminated by ',' optionally enclosed by '"' lines terminated by '
    ';
    Query OK, 3509 rows affected
    Records: 3509  Deleted: 0  Skipped: 0  Warnings: 0
    #导出,如果指定outfile目录,注意对其有写入权限;默认保存在datadir
    mysql> select * from db_swzf.area_info into outfile 'area_info.txt' fields terminated by ',' optionally enclosed by '"' lines terminated by '
    ';
    Query OK, 3509 rows affected (0.04 sec)

    查找文件

    #查找文件
    [root@VMUest /]# find / -type f -name "area_info.txt"
    /usr/local/mysql/data/db_swzf/area_info.txt
    /myshare/area_info.txt
    [root@VMUest /]#
  • 相关阅读:
    使用homebrew安装mysql
    MacOS下命令行安装神器brew
    mac Navicat 破解+汉化(亲测可用)
    eos开发(三)使用cleos命令行客户端操作EOS——关于钱包wallet和账户account
    eos开发(二)使用cleos命令行客户端操作EOS(钱包wallet基础操作)
    php职业规划
    temp
    事业随想
    系统时间错误
    加解密,token
  • 原文地址:https://www.cnblogs.com/ShanFish/p/6893522.html
Copyright © 2020-2023  润新知