Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MYSQL


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Outfile Permissions


I tried to write a query out to a file, but I got this message:

ERROR 1 (HY000): Can't create/write to file '/home/jason/test.csv' (Errcode: 13)

How can I set mysql to allow those permissions to write anywhere I want?

When I don't specify the directory, the command works,




View Complete Forum Thread with Replies

Related Forum Messages:
Into Outfile
I am using MySQL v4.1.20. I need to output records to a file the customer can then open with MS Excel. I could not get the PHP script to create this file so I went to PHPMyAdmin to craft the query.

Here is what I am trying:

SELECT *
INTO OUTFILE 'd:siteshansenplus.csv'
FIELDS ESCAPED BY ''
ENCLOSED BY '"'
TERMINATED BY ','
FROM plusservices;

There are records in the table. The query runs but returns a null data set and no file is created.

I have tried many variations on the SQL syntax. This version is the only one that will run.

View Replies !
Outfile
Tried to write data from a query out to a file and get told permission denied if I use any directory paths - unix. If I jsut put a name.txt, it exports, but I can't find the file anywhere, yet if I re-export, I'm told the file already exists.
What am I missing?

View Replies !
Add Headers To Outfile
I'm selecting records into an OUTFILE;

SELECT foo,bar INTO OUTFILE '/tmp/foo' FIELDS TERMINATED BY ',' FROM bar

I would like to add the headers foo and bar to the output file. How can I have mysql do that automatically.

View Replies !
Outfile Of Sql Data
Here the SQL Statement:
mysql> select c.company_id, c.name from company c, co_directory d where c.company_id=d.company_id and d.directory_id=10 into outfile "comp_dir10.txt";
I have executed the above statement in my mysql server. Where the output file will stored. ?

View Replies !
Into Outfile In Client PC
I'm Using Mysql V3.22+ And Im Trying This Query Select ... Into Outfile... In the Mysql Control Center But It Cant Work! Does Any 1 Can Tell Me How To Write The Data In The Database Into A File In Client Pc

View Replies !
Select * Into Outfile
im trying to execute this sql statement

select * into outfile '/tmp/numbers.txt' from tableName where thisField like '%this%'

the statement executes with no errors, but the text file is not created.

when i create a file of the same name on the server, and execute, an error kicks up saying 'the file already exists'
what do you think is happening here, why is the txt file not being created?

View Replies !
Syntax For Outfile
I'm a kinda newbie at MySQL...
I can't seem to gather where my typo is for running a query for outfile into a file. I get confused to what's going on when I do see that it created a file name "Datalist.txt" in the c: drive but its filesize is 0kb -an empty file...What to do??

SELECT TABLE2.file1
lines terminated by '
'
FROM TABLE1, TABLE2
where (TABLE2.TABLE2_id=TABLE1.TABLE2_id) and (TABLE2.file='OutPutFile.txt') limit 100;

View Replies !
Select Into Outfile
I'm using the comand select * into outfile. It´s working and I get a .txt-file. My problm is, that I need the headers of the columns and right now they are not included. Is there a comand, what tells Mysql to write them in the text-file? MySQL-version is 4.0.

View Replies !
SELECT ... INTO OUTFILE
I have a quick question about using the SELECT ... INTO OUTFILE command.

Whenever I try to export some rows to a text file (e.g. XYZ.csv) that already exists on the destination folder, I get an error message saying "File XYZ.csv already exists".

Is there any option in the SELECT .... INTO OUTFILE syntax that allows me to overwrite the file I'm trying to create?

I've searched for answers and tried to play around with IGNORE or REPLACE, but could not make it work. Here is a simple example of what I'd like to do: ....

View Replies !
Select Into Outfile
I'm using the following command to export data:

SELECT * FROM Agents INTO OUTFILE '/tmp/agentsUpload4.txt' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '';

But I have N and little squares(ASCII null bytes?)in the output where the tables contain nulls.
How can I tell mySQL to output these as ''(empty string) instead?

View Replies !
Remote OUTFILE
I have three servers (S01,S02,S03)... my aplication PHP run in S01 and there are two databases in S02 and S03.

I make one file and I'm using LOAD DATA LOCAL INFILE INTO tbl_xxx to load file in S01 to S02.

My problem is:

I need export data from S03 to S01 using only mysql.
I'm using SELECT OUTFILE, but this statment is only local.

is it possible?

View Replies !
OUTFILE To Blob
i wonder if this is possible:

1) I would like to create a backup of data from a trigger - this backup should load all data regarding a user (from various tables) into blob columns in a other table

now - i know one can use outfile ...... and then load it back into a blob - however , my problem is that i will be using mysql on a shared hosting platform ... writing to file wil not be permitted... i will have to insert the blob directly from a varaible or a select query..

View Replies !
INTO OUTFILE Permission
I have the MySQL server on a shared file server, and would like the internal network users to query the database and store the results in text or Excel format on their local drives (Or a mapped shared drive).

Currently in the test version of this system,i have Mysql running on local host and the scripts on the same system. All the files are traded locally under test.
But when i try to save the generated excel files to a shared location i get an error.

View Replies !
Permissions On Mac
I used MAMP to set up MySQL and Apache on my Mac and installed Drupal. Everything was working fine but I thought that I had forgotten to change the password for the 'root' user in mysql. So,with MAMP when you go to "localhost:8888 it gives you a start page where you can access mysqladmin and others. I used mysqladmin to change the root user properties but now when I try to launch the start page I get "could not connect with mysql server"

Any idea how I can get to MySQL another way and fix it without having to reinstall? My Drupal installation still works so I know MySQL is working but I can't get to the admin/start page anymore.

Also, I'm a complete newb at this stuff.. I know I can go to a terminal session on my Mac to access mysql directly but I don't know enough about it to do anything.

View Replies !
Variables In Select Into Outfile
I wan to use a variable for the outfile file name in a select into clause. I am
doing something like:

set @fileName="/tmp/result.text"
SELECT col1, col2 INTO OUTFILE @fileName
FIELDS TERMINATED BY ','
FROM test_table;

the interpreter dies at the @fileName...
if I exchange @filename with "/tmp/result.text" it runs fine.



View Replies !
Dump Data Outfile
is there a way to dump just data to a file similar to the way "load data
infile" reads data?

View Replies !
Select Data Into Outfile
Thought I'd post that info here in case someone was looking for it.

Guelphdad - I found this thread:
http://lists.mysql.com/mysql/163185
I understand you may get what you want using batch mode.

Now I ran it directly from my command prompt and saved the file in the current directory (on WinXP, sure the same works for Linux)

echo SELECT * from animal | mysql -udavemysql -p***** testdb > mysqloutfile.txt

I found I had to name the database i was using or of course got the no db selected error message.

View Replies !
Select .. Into Outfile Write
global scope:
trying to execute on a schedule a .sql file which writes out
a .csv file.

windows(dont ask)/mysql

in the batch file i have

mysql -u myUser --password=somePass < myFile.sql

the sql query in the file

Code:

use mydb;
select field1,field2,field3
union
select `actField1`,`actField2`,`actField3` into outfile 'F:folder est.csv'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' FROM `detailsTable`;

View Replies !
SELECT ... INTO OUTFILE Options
how to use the SELECT ... INTO OUTFILE command to create a csv file of query output. The problem i have is that the resulting file doesnot have column headers. Is there an option that i need to turn on/off to enable the output file have column headers.

View Replies !
Outfile Name As Parameter In Proc
can I use the outfile_name as a parameter for my proc?

DELIMITER $$

DROP PROCEDURE IF EXISTS `shema`.`sp_name` $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_name`(in outfile_name varchar(100))
BEGIN

SELECT * FROM manufacturers
limit 11
INTO OUTFILE outfile_name
FIELDS TERMINATED BY ' '
LINES TERMINATED BY '
' ;

END $$

DELIMITER ;

I get an error

please correct my e-mail address to Robertsmargalit@yahoo.com

View Replies !
Dynamically Change Outfile Name
I've tried many things, but I just can't seem to solve this...
Here's what I want to do: I'm going through some data with a cursor and I want to take each row that the cursor fetches into a separate file. To achieve this, I have to dynamically change the file name, but I can't seem to be able to do it, although I tried several solutions.

Here's my code at the moment:

CREATE PROCEDURE curdemo()
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE inc INT DEFAULT 1;
DECLARE a,b TEXT;
DECLARE cur1 CURSOR FOR SELECT CONCAT(book_description, book_extended) FROM bookmark;

DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;

OPEN cur1;

REPEAT
FETCH cur1 INTO a;
IF NOT done THEN
SELECT CONCAT('d:/tmp/result', inc, '.txt') INTO b;
SELECT a INTO OUTFILE b;
SET inc=inc+1;
END IF;
UNTIL done END REPEAT;

CLOSE cur1;
END;

View Replies !
Using Variable In OUTFILE Path
I am atmysqlting to create an XML text file for selected records using the following (simplified) code. The SQL statement produces the desired result as long as I leave off the INTO OUTFILE portion. And it works if I set the file name to a string i.e. ‘filename.xml’ and only send one record.

However when I try to create multiple files by adding a variable filename, I get an error message:
Unknown column 'AssemNum' in 'field list'

CREATE PROCEDURE WriteFile(In StartID Int, EndID Int)
BEGIN
Declare Path text default 'C:/mysql/ ';
WHILE StartID <= EndID DO
Begin
set @xsql = concat("select AssemNum, mySQLStatement
from AssemData where AssemID = StartID;
INTO OUTFILE '",concat(Path,AssemNum,'.xml'),"'
LINES TERMINATED BY '
'");
PREPARE stmt from @xsql;
EXECUTE stmt;
SET StartID = StartID + 1;
END;
END WHILE;
END

View Replies !
Is It Possible Outfile Without Null Fields?
I would like my end oufile to not have /N or NULL in fields that are null or to have a query that would filter out all the null fields before exporting.

View Replies !
Korean File Name For Outfile
select * into outfile 'filename' from table;

When I supply a korean/japanese file name in place of 'filename' in the above query, file is getting generated but with non readable krean/japanese file names.

I am running MySQL 4.1.12 with multi lingual support. utf8 as default character set in both client and server.

View Replies !
SELECT INTO OUTFILE 'filename'
Im trying to create a stored procedure in mysql 5 to dump the result of a select statement into a file. When i give the actual file name, it works perfectly.

I want to give the filename as a variable that is parsed into the procedure, how do I do this.

This is the procedure i used, and it works...

CREATE PROCEDURE `genfile`()
BEGIN
SELECT * FROM vreg INTO OUTFILE 'TEST.TXT';
END

Please tel me how i can parse a filename as a parameter and use it as the filename.
When I do the below, i get an error,

CREATE PROCEDURE genfile(IN filename VARCHAR(100))
BEGIN
SELECT * FROM vreg INTO OUTFILE filename;
END

View Replies !
Is It Possible To Use INTO OUTFILE To Amend A File?
I'm using multiple SELECT ... INTO OUTFILE commands to write the results to seperate text files at the moment. Would prefer if the results of each statement were written to the same file (with each statement amending, rather than replacing the file contents). Is this possible?

View Replies !
Syntax Error Using INTO OUTFILE Without FROM
This works:

SELECT "x" INTO OUTFILE "/path/xxx" FROM table-name;

This fails with a syntax error:

SELECT "x" INTO OUTFILE "/path/xxx";

Shouldn't this work?

I want to use this syntax in a UNION to add a constant value row to the results of the first SELECT, and the final SELECT is the one that has to have the INTO OUTFILE. No FROM is required, but the syntax fails.

Is there some requirement for FROM with INTO OUTFILE? Or is this a bug?

View Replies !
Default Permissions
This is a fairly simple question but I'm new to mySQL. To log on to
mySQL I need to type at the prompt:

mysql --user='username' --password='password'

as opposed to just typing mysql and being recognized without having to type identification. Anyone know how I can change this?

View Replies !
Database Permissions
I've got databases on one box i have to transfer to another box, both are running Linux one a Centos4 machine, the other rh9 i think. I could tar up the /var/lib/mysql directory, but i was lead to believe that was a bad idea. I don't know the permissions of the user's and i don't want to give out global permissions. What i was wondering is there a way i can do a mysqldump on the databases on machine1, which will drop everything needed to recreate them in to a .sql file, transfer that to machine2 and then use mysqladmin to load it and have all the settings back in business? I believe they're both mysql4 installs, though machine1 might be mysql3.23, not sure.

View Replies !
MySQL Have No Permissions
I have installed mysql (under SuSE 8.1) and everything seems to work
fine when I am logged in as root. However, with my normal user profile
I can get a mysql> prompt but have no permissions to carry out any
database operations.

I would really like to work with my normal profile and am hoping that it
is merely a question of setting permissions correctly. Can anyone tell
me which files and paths I should check (and change)?

Ideally, I would like mysql to create and manage the database files in
my normal /home directory (rather than in the mysql directories). Is
this possible? Is this desirable? Which settings would I need to
change to allow this? Or should I just let mysql create the databases
in it's default directory and set the permissions there?

View Replies !
MySQL Permissions
I would like mysql to create and manage the database files in
my normal /home directory (rather than in the mysql directories). Is
this possible? Is this desirable? Which settings would I need to
change to allow this? Or should I just let mysql create the databases
in it's default directory and set the permissions there?

View Replies !
Permissions Change
Running MySQL 4.0.18 (upgraded from MySQL 3.x), I can set the host for a user to "%", and can connect from localhost just fine, as well as remote locations.On another server running 4.0.21 (clean install), if I set the host to "%", I cannot connect from localhost unless I also set a "localhost" entry as well for that user.

View Replies !
Permissions With New Db's
I've got php script that created a database, then the tables in the database.
The user in which the script is run, doesn't have the permissions to create a 'new' db. Moreover, mysql says that because the user is trying to create a new db, and there isn't a row specifying that the use has permission, doesn't allow the user to create the db.
My solution is that I can create a row in the mysql.db table that will allow for the user to have proper permissions.
My problem is that once I insert that row, it takes another post to the page for the permission to actually take hold.
Is there a way to have the permissions take hold sooner?
Some of the things I have tried would be toRedirect the page to (with a php header call) to re-load the pageClose the mysql connection so that a new one would have to be opened

View Replies !
Resolving Permissions
I have mySQL Administrator (and subsequently mySQL) installed on my iBook. I want to connect to mySQL on my Red Had Linux 9 test server with the mySQL Administrator, but I get the following error message:
Code:

Could not connect to mySQL instance at [SERVER IP ADDRESS]
Error: Host '[IBOOK IP ADDRESS]' is not allowed to connect to
this mySQL server (code 1130)

I'm sure there's an easy fix for this, but since I'm a bit new at this, I'm not sure where to look.

View Replies !
User Permissions
Is there a special permission required for a user to be able to run a "select ... into dumpfile" statement? I'm getting a 1045 error when attempting this on my server. I've already verified that file permissions are not an issue.

View Replies !
Custom Permissions
I need to assign different 3 different types of users, each with his own permissions and am unsure how to proceed. One of these users will require remote access to all records. I have mySQL 5 and mySQLadmin tool. Both are installed on WinXP and mySQL will be accessed through PHP's connection functions.

Can someone show me an example of setting a user with specific table and row privileges for security purposes? ie: a a user can't modify adata in x table, only read. Another user can write in rows w and x of table y only and can read all of y table but not table z.

View Replies !
Trust Permissions
I am trying to configure a mySQL server on XP machine, and wish to allow ASP.NET application access the database from a remote machine.

1. How do I set Trust permissions to a catalog?
2. How do I allow remote connections?

View Replies !
Add Host To Permissions
Typically, one does something like "grant x,y,z on db.* to user1@localhost identified by 'password'". Is there a good way to clone the permissions for "user1@trusted-host1" et al? Particularly sometime later when one doesn't remember exactly what "x", "y" and "z" were exactly? I can look at the bazillion settings already there, but it's rather a pain to count exactly how many '"",''s and '"y",''s have to be where in the insert and what I really want is to just clone the entry, changing one field...

View Replies !
Root Permissions
root permissions are messed up, i'm unable to create new databases with root account and i cant change permissions for the root account while logged in as root

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

View Replies !
Permissions Problem
I can query my MySQL database with any SELECT, UPDATE, DELETE, etc. queries, and it works perfectly, but when I try to do a LOAD DATA INFILE query, I get a permissions problem. Any ideas why this might be?

View Replies !
User Doesn't Have Permissions?
I install a mysql backup utility to backup my database if things go wrong. I went to test it to make sure it would work as it emails me the sql file, I deleted my database (using phpmyadmin) and tried to import the sql file which shoots me an error giving me an error that I didn't have permission to create a database. How do I give myself permission to create a database?


View Replies !
Select ... Outfile ... Fixed Length?
I have query that I export into a file using the "outfile" syntax. I can
use the following lines of code to create a delimited file but I want to
know if I can create a fixed length file? Any ideas?

delimited file:
Select GivenName, Surname, Address, City, State, ZipCode
into outfile 'xx.csv' fields terminated by ',' lines terminated by '
'
from kbm
where zipcode = '12345'

View Replies !
Accent Problem With Outfile Command
I'm using mysql 4.1.
When I insert data with special french character with accent é, à...
and that I use select command to see the line, I can see the
characters correctly.
But when I use the outfile command the characters are not in the
correct format.

I tried several charset and collation, but it seems that it's not the
problem.

View Replies !
Select Into Outfile With Field Descriptions?
Is there a way to have the field descriptions put into an outfile? When I do a Select * from data, the display shows the field names, however when I do the select * into outfile /tmp/test.txt the field names are not in the file.

View Replies !
Running SELECT INTO OUTFILE As A CRON Job
I need to run the "SELECT * INTO OUTFILE" command as a CRON job. I can do this via command line and it works fine, but when I add it to my CRON file it does not run.

My problem is I dont know how to create a CRON job or script that logs into mySQL and then runs the "SELECT * INTO OUTFILE" command.

I am currently running "mySQL DUMP" as a CRON job without any problem.

View Replies !
SELECT INTO OUTFILE With Column Headers
I've just written a stored procedure that uses the SELECT INTO OUTFILE command. I'd like the file it writes to contain the column headers similar to the way that they show up from a command line call.

View Replies !
How To Get MY SQL Query Messages Into A Single Outfile
I want to run set of queries and want to get the messages after executing them into one outfile.

e.g when I run query "Select * from accounts", when the query is successfully executed, it gives message "1000 rows in set (0.01) sec".

I want to get all such messages from different query sets into one outfile.

Can anybody guide me on how to get the same?

View Replies !
MySQL Outfile Escaping Characters
SELECT people_id, people_fname, people_sname FROM people WHERE people_id IN (1, 2, 3) INTO OUTFILE '/home/test.csv' FIELDS ESCAPED BY '' OPTIONALLY ENCLOSED BY '"' FIELDS TERMINATED BY ',' LINES TERMINATED BY '
'
When executing this statement in SQL Yog i get this error...

Error Code : 1064
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'FIELDS TERMINATED BY ',' LINES TERMINATED BY '
'' at line 1

This is being used for a java service to export results to a csv file. I honestly can't see what is wrong with this. I want to use a backslash to escape chars that need escaping and a double quote to enclose fields. Both of those characters for the query need to be escaped i would think.

View Replies !
Select Into Outfile Sort Data
i have the following query :

(used in visual basic)

"select * into outfile ......where id=irand || id=irand2 || id=irand3 || id=irand4 || id=irand5 "

the problem is that in the file created the data in sorted ASC, i need the data to output like in the query, irand,irand2,irand3,irand4 and irand5,

i see order by 1,2,3,4,5 as a solution but it didnt worked.

View Replies !
How Can I Print The Results Of A Consult Into An Outfile?
I've been trying to print the results of my consults to the database I created. Although I've seen that the query it's OK, I can't find the file where are my results. Do you know how can I print my results to one outfile or where I could find it?

View Replies !
Deleting Files Created By INTO OUTFILE
I created output files using the INTO OUTFILE. I redirected the files to be stored in my local drive. But when I try to delete these files if returns an error :

Cannot delete test: Access is denied.
Make sure the disk is not full or write-protected and that the file is not currently in use.

I do have the permission to delete or modify the files. I can delete any other document within the same drive. I even reboot the computer and tried deleting but it just does not want to be deleted.

FYI, these files are in the .dat and .txt format.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved