mysql提示错误[Error Code] 1290 - The MySQL server is running with the --secure-file-priv option解决办法...
1.進(jìn)入mysql查看secure_file_prive的值
$mysql -u root -p
mysql>SHOW VARIABLES LIKE "secure_file_priv";
secure_file_prive=null?? --?限制mysqld 不允許導(dǎo)入導(dǎo)出
secure_file_priv=/tmp/?? --?限制mysqld的導(dǎo)入導(dǎo)出只能發(fā)生在/tmp/目錄下
secure_file_priv=' '?????????--?不對(duì)mysqld?的導(dǎo)入?導(dǎo)出做限制
2.更改secure_file_pri的值
/usr/local/mysql/support-files中的my-default.cnf配置文件,就把它復(fù)制到/private/etc中,重命名為“my.cnf”,并加入secure_file_priv='',重啟mysql服務(wù)器即可。
3.導(dǎo)入csv文件
-- sql導(dǎo)入csv文件?
load data local infile '/Users/jojo/dumps/train.csv' --文件目錄
into table new_table -- 這里導(dǎo)入csv會(huì)出錯(cuò),具體解決方法見(jiàn)"問(wèn)題解決"?
fields terminated by','optionally enclosed by '"' escaped by '"'?
-- 字段之間以逗號(hào)分隔,字符串以半角雙引號(hào)包圍,字符串本身的雙引號(hào)用兩個(gè)雙引號(hào)表示?
lines terminated by'\r\n' -- 數(shù)據(jù)行之間以\r\n分隔
4.導(dǎo)出csv文件
select * from table_name
into outfile 'C:/ProgramData/MySQL/MySQL Server?5.7/xx.csv'
FIELDS TERMINATED BY ',' ??
OPTIONALLY ENCLOSED BY '"' ??
LINES TERMINATED BY '/n'?
轉(zhuǎn)載于:https://www.cnblogs.com/chancy/p/10916584.html
總結(jié)
以上是生活随笔為你收集整理的mysql提示错误[Error Code] 1290 - The MySQL server is running with the --secure-file-priv option解决办法...的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Spring web.xml详解
- 下一篇: Redis Cluster集群架构实现