当前位置:网站首页>Problems encountered when MySQL saves CSV files
Problems encountered when MySQL saves CSV files
2022-07-03 10:02:00 【Star soul is not a dream】
LOAD DATA INFILE '/home/xx/xxx.csv'
When I use above SQL Statement will csv file Import mysql When , error :
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
Check out the official documents ,secure_file_priv Parameters are used to limit LOAD DATA, SELECT …OUTFILE, LOAD_FILE() To which specified directory .
- secure_file_priv by NULL when , Said restrictions mysqld Import or export... Is not allowed .
- secure_file_priv by /tmp when , Said restrictions mysqld Only in /tmp Perform import and export in the directory , Other directories cannot execute .
- secure_file_priv When it's not worth it , Means unrestricted mysqld Import and export in any directory .
see secure-file-priv The value of the parameter :
mysql> show global variables like '%secure_file_priv%';
Output secure_file_priv /var/lib/mysql-files/
Description files can only be imported in this location / export . You can put the file in this location , You can also specify your own secure_file_priv Location .
The assumption is modified to /home/xx
sudo vim /etc/mysql/my.cnf Added as :
[mysqld]
secure_file_priv='/home/xx'
Look again :
mysql> show global variables like '%secure_file_priv%';
Output secure_file_priv' /home/xx'
restart mysql
service mysql restart
Report errors :
ERROR 29 (HY000) at line 16: File '/home/xx/xxx.csv' not found (OS errno 13 - Permission denied)
sudo vim /etc/apparmor.d/usr.sbin.mysqld } front Join in /home/xx/** rw,
sudo /etc/init.d/apparmor reload
sudo mysql -u root -p < xx.sql # success
In the following sentence `order` `height(cm)` Column names use backquotes , To avoid conflict , here order Is the key word and () There will be problems , So add Inverse question mark . The rhetorical question is Number keys On the left .
CREATE TABLE president_heights (
`order` BIGINT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(100) NOT NULL,
`height(cm)` INT NOT NULL,
PRIMARY KEY (`order`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;close mysql: service mysql stop
Reference resources : take CSV File import MySQL surface -MySQL course
边栏推荐
- Basic knowledge of MySQL database (an introduction to systematization)
- ADS simulation design of class AB RF power amplifier
- Fundamentals of Electronic Technology (III)__ Chapter 6 combinational logic circuit
- 没有多少人能够最终把自己的兴趣带到大学毕业上
- 4G module designed by charging pile obtains signal strength and quality
- STM32 external interrupt experiment
- CEF download, compile project
- (1) What is a lambda expression
- is_ power_ of_ 2 judge whether it is a multiple of 2
- 2020-08-23
猜你喜欢

Stm32-hal library learning, using cubemx to generate program framework

Openeuler kernel technology sharing - Issue 1 - kdump basic principle, use and case introduction

没有多少人能够最终把自己的兴趣带到大学毕业上

Yocto Technology Sharing Phase 4: Custom add package support

Working mode of 80C51 Serial Port

在三线城市、在县城,很难毕业就拿到10K

yocto 技術分享第四期:自定義增加軟件包支持

Notes on C language learning of migrant workers majoring in electronic information engineering

Mysql database underlying foundation column

Code word in NR
随机推荐
单片机职业发展:能做下去的都成牛人了,熬不动就辞职或者改行了
2021-10-28
2021-01-03
01 business structure of imitation station B project
干单片机这一行的时候根本没想过这么多,只想着先挣钱养活自己
Seven sorting of ten thousand words by hand (code + dynamic diagram demonstration)
Fundamentals of Electronic Technology (III)__ Chapter 6 combinational logic circuit
一个可执行的二进制文件包含的不仅仅是机器指令
Fundamentals of Electronic Technology (III)__ Chapter 1 resistance of parallel circuit
2.Elment Ui 日期选择器 格式化问题
I think all friends should know that the basic law of learning is: from easy to difficult
Yocto Technology Sharing Phase 4: Custom add package support
My openwrt learning notes (V): choice of openwrt development hardware platform - mt7688
嵌入式本来就很坑,相对于互联网来说那个坑多得简直是难走
Application of external interrupts
Swing transformer details-2
Comment la base de données mémoire joue - t - elle l'avantage de la mémoire?
Which language should I choose to program for single chip microcomputer
2021-10-27
is_ power_ of_ 2 judge whether it is a multiple of 2