0
点赞
收藏
分享

微信扫一扫

MySQL将查询结果导出到文件中报错解决办法: 1290 - The MySQL server is running with the --secure-file-priv option


MySQL将查询结果导出到文件中

SELECT ... INTO OUTFILE 语句可以将查询结果导出到文件中。这通常用于备份数据或与其他系统进行数据交换。

示例表结构

CREATE TABLE orders (
    order_id INT PRIMARY KEY,
    customer_name VARCHAR(100),
    order_date DATE,
    total_amount DECIMAL(10, 2)
);

导出查询结果到文件

SELECT order_id, customer_name, order_date, total_amount
INTO OUTFILE '/tmp/orders.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM orders;

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

MySQL将查询结果导出到文件中报错解决办法: 1290 - The MySQL server is running with the --secure-file-priv option_数据交换


解决办法:

windows下的话,设置该变量的值即可。linux下可以禁用该参数,或指定该变量的值。

MySQL将查询结果导出到文件中报错解决办法: 1290 - The MySQL server is running with the --secure-file-priv option_数据库_02


举报

相关推荐

0 条评论