最近在使用mysql时发现以下问题,不知道怎么解决,求大神指点一二
mysql> load data infile 'part.csv' into table PART fields terminated by ','  optionally enclosed by '"' escaped by '"' lines terminated by '\r\n';
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

解决方案 »

  1.   

    找到解决办法了,哎,求人不如求己,在这给大家分享一下吧。
    这是因为在MySQL 5.7.6版本之后,导入文件只能在secure_file_priv指定的文件夹下
    用show 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.00 sec)
    将导入文件放在 /var/lib/mysql-files/文件夹下就可以了