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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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... |
|
|||
|
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) |
|
|||
|
>
> 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. |
|
|||
|
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) |