Questions tagged [select-into-outfile]
34 questions
19
votes
4 answers
MySQL exporting INTO OUTFILE --secure-file-priv error when using set directory
I'm trying to run the following on a MySQL database:
SELECT * FROM mysql.db
INTO OUTFILE "C:\ProgramData\MySQL\MySQL Server 5.7\Uploads\db.csv"
FIELDS TERMINATED BY '|'
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
I get the error:
SQL Error (1290):…

Lateralus
- 351
- 1
- 3
- 11
3
votes
2 answers
MySQLdump with WINDOWS10 : OS errno 13 - (Permission denied) when executing 'SELECT INTO OUTFILE'
I am unable to write tab separated text files into specified TSV/ folder using mysqldump on WINDOWS10 (MySQL80 service).
The Command prompt (or powershell) is in admin mode.
secure-file-priv ="" in my.ini MySQL config file.
MySQL was installed…

Alexis
- 1,343
- 12
- 15
3
votes
2 answers
Where does MariaDB `mysql` client save the output file of a select statement?
From this documentation: https://mariadb.com/kb/en/library/select-into-outfile/
I ran
MariaDB []> select ... into outfile 'leads_ny.csv';
Query OK, 6674 rows affected (0.47 sec)
Now I can't find the file. I looked in the current working directory,…

Chloe
- 25,162
- 40
- 190
- 357
3
votes
2 answers
Export data from Amazon Aurora to S3 using outfile?
I am trying to export data from a table in my Aurora database to a bucket I have created in my S3, using the "SELECT INTO OUTFILE S3" command that is promoted by Amazon here.
Select * from testauroradb.'table1' into outfile S3…

Evan
- 288
- 1
- 10
- 19
3
votes
1 answer
Mysql How to outfile in csv format, with sheets options?
I want to export data from mysql into a csv. There are many tables so I want a csv file with many sheets. How it can be done?
I suppose somethings like:
SELECT *
FROM product
WHERE active = 1
INTO OUTFILE '/root/tmp/data.csv'
FIELDS TERMINATED BY…

Jacky Lau
- 665
- 5
- 21
3
votes
3 answers
mysql select into outfile without any line termination character
I try to print all the data from one field from a table into a file witout any line/field termination character. I would simply like to have all the rows concatenated and printed as one line in the output line. Here how I am doing it:
CREATE TABLE…

Mateusz Fenske
- 41
- 4
2
votes
1 answer
How to import certain data from file on AWS Aurora
Problem: I have an Aurora RDS database that has a table where the data for a certain column was deleted. I have a snapshot of the DB from a few days ago that I want to use to populate the said column with the values from the snapshot. The issue is…

Mircea B
- 35
- 4
2
votes
1 answer
SELECT * FROM .. INTO OUTFILE and save on hosting or send FTP - HOW TO?
I need help. When I try this - SELECT * FROM .. INTO OUTFILE - on local, everything is ok. When I try it on my hosting, I receive error message #1045 - Access denied for user '..'@'%' (using password: YES) . How to do it make it work? Thanks for any…

Honza Hála
- 87
- 1
- 9
2
votes
2 answers
MySQL: SELECT * INTO OUTFILE returns always empty array and no error_code?
I'm trying to dump a table into a MySQL file using PHP.
But what I get is an empty array, and not any file is created. While if I remove the instruction " INTO OUTFILE '$mysqldumpfile'", everything works fine.
please here the code:

Tormy Van Cool
- 658
- 10
- 29
1
vote
1 answer
SELECT INTO OUTFILE - Can't create/write to file
This query:
SELECT ... INTO OUTFILE '/usr/services/001/tmp/`database4ed78d1eb0986`.`tblTemporaryReportFinishedOrders`.tmp';
Produces this error:
Error Code: 1. Can't create/write to file…

Richard Knop
- 81,041
- 149
- 392
- 552
1
vote
1 answer
weekly event select into file with different filenames depending on the variables(MariaDB)
I've always been a silent reader here until now.
Now I would like to ask for your expertise and post my ver first question here.
I have to achieve the following task on a weekly basis in my MariaDB via Events:
Every Week on Saturday night at…

K_Urahara
- 9
- 2
1
vote
1 answer
Error Code: 1290. The MySQL server is running with the --secure-file-priv option
This has really been annoying me. I am using MySQL on a Windows computer.
The MySQL statement that I am trying to run is as follows:
SELECT tempInfo.clientName FROM tempInfo LIMIT 1 INTO OUTFILE 'test.out'
I understand that I need to change the…

Daelin Campleman
- 11
- 1
1
vote
1 answer
Unable to download database as CSV
Im trying to download a whole database but i keep getting the error:
Parse error: syntax error, unexpected '' LINES TERMINATED BY ''
(T_CONSTANT_ENCAPSED_STRING) in C:\wamp64\www\cookies\download_db.php
on line 6
My code:

Minnen
- 441
- 8
- 27
1
vote
1 answer
Difference in "fields eclosed by" and "fields optionally escaped by"
In MySQL there are two options for the SELECT INTO OUTFILE command:
--fields-enclosed-by=char
--fields-optionally-enclosed-by=char
What's the basic difference in these two options?
Enclosed by means forcefully all fields are escaped by given char…

Aman Aggarwal
- 17,619
- 9
- 53
- 81
1
vote
1 answer
Automated database backup using PHP event
I'm assigned with a task of creating an automated backup for a database. I used a php event and I want to save my all my backups by a unique name. So I used a date_format and following is my code.
SELECT * FROM redcap_data ;
OUTFILE ' ",…

Hansy Kumaralal
- 169
- 3
- 13