• MySQL服务器正在使用--secure file priv选项运行,因此无法执行此语句


    The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

     

    secure-file-priv特性
    secure-file-priv参数是用来限制LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE()传到哪个指定目录的。

    • ure_file_priv的值为null ,表示限制mysqld 不允许导入|导出

    • 当secure_file_priv的值为/tmp/ ,表示限制mysqld 的导入|导出只能发生在/tmp/目录下

    • 当secure_file_priv的值没有具体值时,表示不对mysqld 的导入|导出做限制

    如何查看secure-file-priv参数的值:

    show global variables like '%secure%';
    
    mysql> show global variables like '%secure%';
    Variable_name Value
    require_secure_transport OFF
    secure_auth ON
    secure_file_priv /var/lib/mysql-files/

    3 rows in set (0.02 sec)

    MYSQL新特性secure_file_priv对读写文件的影响
    此开关默认为NULL,即不允许导入导出。

    解决问题:
    windows下:修改my.ini 在[mysqld]内加入secure_file_priv =

    linux下:修改my.cnf 在[mysqld]内加入secure_file_priv =
    MYSQL新特性secure_file_priv对读写文件的影响
    然后重启mysql,再查询secure_file_priv

     如果在employee表中包含了中文字符,使用上面的语句则会输出乱码。此时,加入CHARACTER SET gbk语句即可解决这一个问题。修改SQL代码如下:导出shopping数据库中的查category3表

    SELECT * FROM shopping.`category3` INTO OUTFILE
    'C:/Users/Administrator/Desktop/68/cc/a2.txt'

    CHARACTER SET gbk

    FIELDS
    TERMINATED BY '、'
    OPTIONALLY ENCLOSED BY '"'
    LINES
    STARTING BY '>'
    TERMINATED BY ' ';

    原著:https://www.cnblogs.com/monkeybron/articles/10888629.html
    没有不会的技术,只有你想不到的技术。。。。。。。。。。。。。。
  • 相关阅读:
    沈阳集训day2
    ac自动机
    2018沈阳集训day1
    洛谷P1875 佳佳的魔法药水
    洛谷P1941 飞扬的小鸟
    Noip2016day2
    1123: [POI2008]BLO
    1718: [Usaco2006 Jan] Redundant Paths 分离的路径
    P3119 [USACO15JAN]草鉴定Grass Cownoisseur
    [LeetCode] Clone Graph
  • 原文地址:https://www.cnblogs.com/zenghongfei/p/12837107.html
Copyright © 2020-2023  润新知