Is it possible to prompt for input from a user with the mysql command
line tool when running a sql script?
(for thinks like granting permissions to new users)
IE:
grant.sql contains something like:
grant select on *.* to @myuser ;
then from the command line running
mysql < grant.sql
I could write a shell script or perl script, but I was wondering if I
could just have mysql command line handle it like sql*plus in Oracle...
|
|
0
|
|
|
|
Reply
|
phildebrand
|
1/16/2008 8:16:42 PM |
|
On Wed, 16 Jan 2008 12:16:42 -0800 (PST), phildebrand
<phil.hildebrand@gmail.com> wrote:
>Is it possible to prompt for input from a user with the mysql command
>line tool when running a sql script?
>
>(for thinks like granting permissions to new users)
>
>IE:
>
> grant.sql contains something like:
>
> grant select on *.* to @myuser ;
>
>then from the command line running
>
> mysql < grant.sql
>
>I could write a shell script or perl script, but I was wondering if I
>could just have mysql command line handle it like sql*plus in Oracle...
Don't waste your time asking and waiting for an answer.
Just try it.
--
( Kees
)
c[_] An oyster is a fish built like a nut. (#17)
|
|
0
|
|
|
|
Reply
|
Kees
|
1/16/2008 9:04:19 PM
|
|
>
> Don't waste your time asking and waiting for an answer.
> Just try it.
> --
> ( Kees
> )
> c[_] An oyster is a fish built like a nut. (#17)
I did try it first, but I couldn't get it to work, and after looking
at all the docs couldn't find anything, so I thought I'd throw the
question out there in case I missed something.
|
|
0
|
|
|
|
Reply
|
phildebrand
|
1/16/2008 9:34:07 PM
|
|
On Wed, 16 Jan 2008 13:34:07 -0800 (PST), phildebrand
<phil.hildebrand@gmail.com> wrote:
>>
>> Don't waste your time asking and waiting for an answer.
>> Just try it.
>> --
>> ( Kees
>> )
>> c[_] An oyster is a fish built like a nut. (#17)
>
>I did try it first, but I couldn't get it to work, and after looking
>at all the docs couldn't find anything, so I thought I'd throw the
>question out there in case I missed something.
Ok. I never tried myself, and i must confess I never felt
the need. I think I would handle the user interaction in a
shell/PHP/Perl/awk/whatever script and have the script
compose a proper statement to be executed by mysql
(commandline tool or MySQL call interface in PHP/Perl).
--
( Kees
)
c[_] Read a library, write a shelf. (geof) (#376)
|
|
0
|
|
|
|
Reply
|
Kees
|
1/16/2008 10:15:03 PM
|
|