当前位置:网站首页>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
边栏推荐
- [untitled] proteus simulation of traffic lights based on 89C51 Single Chip Microcomputer
- 內存數據庫究竟是如何發揮內存優勢的?
- 手机都算是单片机的一种,只不过它用的硬件不是51的芯片
- My 4G smart charging pile gateway design and development related articles
- 对于新入行的同学,如果你完全没有接触单片机,建议51单片机入门
- Project cost management__ Cost management technology__ Article 6 prediction
- Raspberry pie installation SciPy
- Stm32f407 key interrupt
- Sending and interrupt receiving of STM32 serial port
- Positive and negative sample division and architecture understanding in image classification and target detection
猜你喜欢

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

嵌入式系统没有特别明确的定义

Hal library sets STM32 clock

el-table X轴方向(横向)滚动条默认滑到右边

Interruption system of 51 single chip microcomputer

Not many people can finally bring their interests to college graduation

There is no shortcut to learning and development, and there is almost no situation that you can learn faster by leading the way

Fundamentals of Electronic Technology (III)__ Logic gate symbols in Chapter 5

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

yocto 技术分享第四期:自定义增加软件包支持
随机推荐
Raspberry pie installation SciPy
Swing transformer details-2
万字手撕七大排序(代码+动图演示)
My notes on intelligent charging pile development (II): overview of system hardware circuit design
SCM is now overwhelming, a wide variety, so that developers are overwhelmed
Synchronization control between tasks
01仿B站项目业务架构
Quelle langue choisir pour programmer un micro - ordinateur à puce unique
Simple use of MySQL (addition, deletion, modification and query)
03 FastJson 解决循环引用
The 4G module designed by the charging pile obtains NTP time through mqtt based on 4G network
Fundamentals of Electronic Technology (III)__ Chapter 6 combinational logic circuit
4G module at command communication package interface designed by charging pile
el-table X轴方向(横向)滚动条默认滑到右边
Fundamentals of Electronic Technology (III)_ Integrated operational amplifier and its application__ Basic arithmetic circuit
Education is a pass and ticket. With it, you can step into a higher-level environment
单片机现在可谓是铺天盖地,种类繁多,让开发者们应接不暇
The third paper of information system project manager in soft examination
My openwrt learning notes (V): choice of openwrt development hardware platform - mt7688
How does the memory database give full play to the advantages of memory?