当前位置:网站首页>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
边栏推荐
- JS基础-原型原型链和宏任务/微任务/事件机制
- Stm32f407 key interrupt
- [Li Kou brush question notes (II)] special skills, module breakthroughs, classification and summary of 45 classic questions, and refinement in continuous consolidation
- Fundamentals of Electronic Technology (III)__ Chapter 6 combinational logic circuit
- How does the memory database give full play to the advantages of memory?
- There is no shortcut to learning and development, and there is almost no situation that you can learn faster by leading the way
- Mysql database underlying foundation column
- 没有多少人能够最终把自己的兴趣带到大学毕业上
- Which language should I choose to program for single chip microcomputer
- Oracle database SQL statement execution plan, statement tracking and optimization instance
猜你喜欢

Eight working modes of stm32gpio and chip naming rules

万字手撕七大排序(代码+动图演示)

Project cost management__ Topic of comprehensive calculation

干单片机这一行的时候根本没想过这么多,只想着先挣钱养活自己

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

03 FastJson 解决循环引用

2021-10-27
![[untitled] proteus simulation of traffic lights based on 89C51 Single Chip Microcomputer](/img/90/4de927e797ec9c2bb70e507392bed0.jpg)
[untitled] proteus simulation of traffic lights based on 89C51 Single Chip Microcomputer

Programming ideas are more important than anything, not more than who can use several functions, but more than the understanding of the program

I didn't think so much when I was in the field of single chip microcomputer. I just wanted to earn money to support myself first
随机推荐
Liquid crystal display
Notes on C language learning of migrant workers majoring in electronic information engineering
My notes on the development of intelligent charging pile (III): overview of the overall design of the system software
STM32 interrupt priority management
Crash工具基本使用及实战分享
Of course, the most widely used 8-bit single chip microcomputer is also the single chip microcomputer that beginners are most easy to learn
How does the memory database give full play to the advantages of memory?
Pymssql controls SQL for Chinese queries
Comment la base de données mémoire joue - t - elle l'avantage de la mémoire?
Oracle数据库 SQL语句执行计划、语句跟踪与优化实例
Raspberry pie installation SciPy
I didn't think so much when I was in the field of single chip microcomputer. I just wanted to earn money to support myself first
03 fastjason solves circular references
You need to use MySQL in the opening experiment. How can you forget the basic select statement? Remedy is coming~
Development of intelligent charging pile (I): overview of the overall design of the system
Project cost management__ Plan value_ Earned value_ Relationship among actual cost and Countermeasures
Interruption system of 51 single chip microcomputer
Positive and negative sample division and architecture understanding in image classification and target detection
4G module initialization of charge point design
Fundamentals of Electronic Technology (III)__ Chapter 6 combinational logic circuit