Actually, here is my case.

There is a script owned by user A running daily.

----script-------
rm -rf /tmp/report.csv

mysql -umysql -pabc table -e "SELECT * into outfile '/tmp/report.csv'
fields terminated by ',' lines terminated by '\n' FROM table;"

In the first run, a file with the following permission and ownership
will be created.
-rw-rw-rw-   1 mysql mysql  2489 Mar  1 11:30 report.csv

In the seconde run, the script will failed as user A have no
permission to remove the file.
In order to run the script daily, ownership of the file should be
changed to user A.

On 3/1/06, CodeHeads <[EMAIL PROTECTED]> wrote:
> On Tuesday 28 February 2006 23:41, Joshua Kugler wrote:
> > You can't do that.  The mysql server runs as user mysql, so it cannot
> > create files owned by another user.  If you run the mysql server as root
> > (don't!), you might be able to do that, but I do not believe mysql has a
> > facility for changing the owner of a file.  You are better off running a
> > script as the user you want to own the file and outputing the results via
> > the script.
> >
> > j----- k-----
>
> I was just going to post something similar to that.
>
> Try something like this:
> #!/bin/bash
>
> Your query you want to run.......
>
> chown user:user /path/to/report.cvs
>
> Then put this in your cron.daily or where ever you wish to run it or crontab
>
> 00 03 * * * /path/to/script
>
> I think I explained that right. :)
>
> --
> Best regards,
> ~WILL~
> Key: http://code-heads.com/keys/ch1.asc
> Key: http://code-heads.com/keys/ch2.asc
> Linux Commands: http://code-heads.com/commands
> Linux Registered User: 406084 (http://counter.li.org/)
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
>
>

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to