Questions tagged [into-outfile]

MySQL's `SELECT ... INTO OUTFILE` command lets you quickly dump the results of a MySQL query into a file on the MySQL server. It generally should not be used for production use.

MySQL's SELECT ... INTO OUTFILE command lets you quickly dump the results of a MySQL query into a file on the MySQL server. It generally should not be used for production use.

From the MySQL documentation

The SELECT ... INTO OUTFILE 'file_name' form of SELECT writes the selected rows to a file. The file is created on the server host, so you must have the FILE privilege to use this syntax. file_name cannot be an existing file, which among other things prevents files such as /etc/passwd and database tables from being destroyed.

One must be able have access to the MySQL server machine, and permissions to operate on files as the mysql user in order to access and manage the dump files. These restrictions mean the SELECT ... INTO OUTFILE command is generally suitable only for testing and debugging.

If you want a dump of a table from a MySQL database on your client machine, you can call the mysqldump binary on the client. If you want a CSV of the results of a MySQL query, you generally need to roll your own code to create that file in your client application, though there are libraries that can help with the CSV format.

139 questions
0
votes
2 answers

Can't create/write to a file in MySQL

I've created a stored procedure which create an CSV file from a table. this is the stored procedure : CREATE DEFINER = `root`@`localhost` PROCEDURE `DO_BACKUP` ( IN `table_name` TEXT ) NOT DETERMINISTIC CONTAINS SQL SQL SECURITY DEFINER BEGIN…
Aimad Majdou
  • 563
  • 4
  • 13
  • 22
0
votes
0 answers

Dumping SQL table to XML file

I am struggling with this. I am using the following SQL to create an XML file, but I am receiving an error: Access denied for user 'designan_testu'@'localhost' (using password: YES) I can INSERT, DELETE, and UPDATE without error. Just INTO OUTFILE…
Solid I
  • 580
  • 5
  • 13
  • 34
-2
votes
1 answer

Write to OUTFILE with Procedure and Event - MySQL

Could someone help me with what is wrong with the below please? DELIMITER $$ CREATE DEFINER=`user1`@`localhost` PROCEDURE `Local_sp_ExtractPOI`() BEGIN SET SESSION group_concat_max_len = 1000000; SET @OutputPath :=…
MrrMan
  • 158
  • 1
  • 13
-2
votes
1 answer

Get path from VBscript variable to use with obj.sql(extQuery) extQuery = select * from table name into outfile '????'

I have this code i need to retrieve a path from a VBScript variable and use it with a mysql query. set fso = WScript.CreateObject("Scripting.FileSystemObject") Mypath = fso.GetAbsolutePathName(".") Fullpath = fso.buildpath(Mypath,"test.txt") then…
DoomneT
  • 1
  • 3
1 2 3
9
10