본문으로 바로가기
반응형

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


MySQL에서 into outfile을 사용하여 테이블을 csv파일로 저장하는 작업을 하던 중

위와 같은 에러가 발생했다.

이는 secure_file_priv 옵션때문에 발생한다.

먼저 다음과 같은 명령어를 입력해본다.


SHOW VARIABLES LIKE "secure_file_priv";


아마 아래와 같은 결과가 나올 것 이다.


+------------------+-----------------------+

| Variable_name    | Value                 |

+------------------+-----------------------+

| secure_file_priv | /var/lib/mysql-files/ |

+------------------+-----------------------+

1 row in set (0.00 sec)


아마 이와 같이 설정되어 있을 것 이다.

/etc/mysql/mysql.conf.d/mysqld/cnf 파일을 열고 

mysqld섹션에 아래의 라인을 추가한다.


secure_file_priv=""


그리고 mysql을 재시동하면 해결된다.

반응형