List:General Discussion« Previous MessageNext Message »
From:Bernd Tannenbaum Date:February 5 2004 6:38am
Subject:Re: Bash script to MySql
View as plain text  
Hi,

Am Donnerstag, 5. Februar 2004 03:43 schrieb Scott Haneda:
> on 02/04/2004 02:23 AM, Bernd Tannenbaum at tannenbaum@stripped
>
> wrote:
> > 2 possible ways to go:
> >
> > Feed a Textfile with your statement in the db:
> > PATH/mysql db < /sql_scripts/sql_statements_as_textfile --password=pass
> >
> > Give command directly In the shell-script:
> > PATH/mysql --skip-column-names -e "SELECT table SET blabla" db
> > --password=pass
>
> I need to select into outfile on this one, which poses a problem to me, I
> can not write the file to any directory as I get a permissions error since
> mysql is the owner of this file, how would I do this ?

Dunno if i get you right.
You want to write the stuff found by your SELECT into a file on your local 
machine but the user mysql does not have permission to write anywhere in your 
system?

If thats the problem then you have few options i think. 
"sudo" would be a way to go. You could give root-rights to a single command of 
ur choice that way.

Another thing is that you can store the value from the SELECT in a 
bash-variable if ya like.
Like this:
var=`PATH/mysql --skip-column-names -e "SELECT
MAX(id) FROM table" db --password=pass`;
This way you can keep the value in the shell and write it wherever you have 
the right to write to. Well, if mysql has no rights at all that won`t help u 
much i think. So if ya cannot change any rights "sudo" is the only option i 
know of but maybe its worth to ask some linux-freaks about it...

Good luck,
Bernd
 






-- 
[Zufallssig 1]
Windows found - Remove? [Y]es [S]ure [F]ine [O]K

Thread
column being created as varchar() when char() requested.Philip Walden3 Feb
  • Re: column being created as varchar() when char() requested.Michael Stassen3 Feb
    • Re: column being created as varchar() when char() requested.Philip Walden3 Feb
      • Re: column being created as varchar() when char() requested.Michael Stassen3 Feb
        • Re: column being created as varchar() when char() requested.Philip Walden4 Feb
          • Monthly reportingScott Haneda4 Feb
            • Bash script to MySqlScott Haneda4 Feb
              • Re: Bash script to MySqlHassan Schroeder4 Feb
                • Re: Bash script to MySqlBernd Tannenbaum4 Feb
                  • RE: Bash script to MySqlRussell Horn4 Feb
                  • Re: Bash script to MySqlScott Haneda5 Feb
                    • Re: Bash script to MySqlBernd Tannenbaum5 Feb
                    • Re: Bash script to MySqlMichael Stassen5 Feb
                      • Re: Bash script to MySqlScott Haneda6 Feb
                        • Re: Bash script to MySqlMichael Stassen6 Feb
              • Re: Bash script to MySqlDuncan Hill4 Feb
              • User Defined FunctionBácskai Gergő" 4 Feb
          • Re: column being created as varchar() when char() requested.Michael Stassen4 Feb
            • Re: column being created as varchar() when char() requested.Philip Walden5 Feb
              • Re: column being created as varchar() when char() requested.Michael Stassen5 Feb
                • Re: column being created as varchar() when char() requested.Philip Walden6 Feb
                  • Re: column being created as varchar() when char() requested.Michael Stassen6 Feb
  • Re: column being created as varchar() when char() requested.Martijn Tonies4 Feb
RE: Bash script to MySqlDan Muey4 Feb