Prompting for input with mysql command line [linux] ?

This is a discussion on Prompting for input with mysql command line [linux] ? within the MySQL Database forums, part of the Database Forums category; Is it possible to prompt for input from a user with the mysql command line tool when running a sql ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-16-2008
phildebrand
 
Posts: n/a
Default Prompting for input with mysql command line [linux] ?

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...
Reply With Quote
  #2 (permalink)  
Old 01-16-2008
Kees Nuyt
 
Posts: n/a
Default Re: Prompting for input with mysql command line [linux] ?

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)
Reply With Quote
  #3 (permalink)  
Old 01-16-2008
phildebrand
 
Posts: n/a
Default Re: Prompting for input with mysql command line [linux] ?

>
> 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.


Reply With Quote
  #4 (permalink)  
Old 01-16-2008
Kees Nuyt
 
Posts: n/a
Default Re: Prompting for input with mysql command line [linux] ?

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)
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:31 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0