views:

239

answers:

2

Hi, I'm new to MySQL, I am trying to create a text file using a stored procedure. I'm currently at the stage where I have a temporary table that contains all of the records that I want to output to a text file. I have the following line at the end of my SP, it works in PHPMYAdmin's query but it does not work when part of a stored procedure the code is as follows:

SELECT * into outfile '../../htdocs/VIP/Temp/temp.txt' from tmp_Menu2;

note that tmp_Menu2 is a table that only includes one field of type VARCHAR(1000)

Any help would be greathly appreciated.

Thank you,

A: 

Yes. The user making the call needs file privileges on the host. The text file will be created on the server.

Pestilence
The directory where I'm putting the information is on the server and the user is the root user which has all the permissions. ???
Pablo
The MySQL user. `GRANT FILE ON db_name.* TO 'mysql_user'@'localhost' IDENTIFIED BY 'passwd'; flush privileges;` You shouldn't run mysql as root, BTW.
Pestilence
Thank you, I'm currently just at the evaluation stage to determine if MYSql is functional enough to devellop my app on. I'm trying to avoid running with Microsoft SQL eventhow I know that DB system very well. MySQL appears to be faster and more flexible as to what platform I need to use so I would like it to work but so far I'm finding a lot of limitations that I don't like.
Pablo
A: 

The problem is with your pathname, when you run it from mysql the pathname is relative to the PHP myadmin directory where as when you call the SP from the mysql console, the path is relative to the current working directory.

e4c5
How do I determine the current directory?
Pablo
I actualy tried creating it in ./ directory and the file is still not getting created as I searched the whole drive for it. Is their somekind of log I can check for the error?
Pablo