当前位置:网站首页>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
- My 4G smart charging pile gateway design and development related articles
- Mysql database underlying foundation column
- Idea remote breakpoint debugging jar package project
- STM32 serial communication principle
- 干单片机这一行的时候根本没想过这么多,只想着先挣钱养活自己
- [Li Kou brush question notes (II)] special skills, module breakthroughs, classification and summary of 45 classic questions, and refinement in continuous consolidation
- Project cost management__ Cost management technology__ Article 8 performance review
- Gif image analysis drawing RGB to YUV table lookup method to reduce CPU occupancy
- Adaptiveavgpool1d internal implementation
猜你喜欢
JS基础-原型原型链和宏任务/微任务/事件机制
My notes on intelligent charging pile development (II): overview of system hardware circuit design
Education is a pass and ticket. With it, you can step into a higher-level environment
Timer and counter of 51 single chip microcomputer
在三线城市、在县城,很难毕业就拿到10K
编程思想比任何都重要,不是比谁多会用几个函数而是比程序的理解
Schematic diagram and connection method of six pin self-locking switch
My notes on the development of intelligent charging pile (III): overview of the overall design of the system software
Oracle database SQL statement execution plan, statement tracking and optimization instance
Programming ideas are more important than anything, not more than who can use several functions, but more than the understanding of the program
随机推荐
Comment la base de données mémoire joue - t - elle l'avantage de la mémoire?
(2) New methods in the interface
Education is a pass and ticket. With it, you can step into a higher-level environment
2020-08-23
STM32 port multiplexing and remapping
Basic knowledge of MySQL database (an introduction to systematization)
03 fastjason solves circular references
JS foundation - prototype prototype chain and macro task / micro task / event mechanism
The new series of MCU also continues the two advantages of STM32 product family: low voltage and energy saving
Project cost management__ Topic of comprehensive calculation
Fundamentals of Electronic Technology (III)_ Chapter 2 principle of amplification circuit__ Crystal triode and field effect triode
Project cost management__ Cost management technology__ Article 6 prediction
My openwrt learning notes (V): choice of openwrt development hardware platform - mt7688
Happy Dragon Boat Festival—— Zongzi written by canvas~~~~~
There is no specific definition of embedded system
自動裝箱與拆箱了解嗎?原理是什麼?
Not many people can finally bring their interests to college graduation
In third tier cities and counties, it is difficult to get 10K after graduation
openEuler kernel 技術分享 - 第1期 - kdump 基本原理、使用及案例介紹
03 FastJson 解决循环引用