Is there any way to pass mysql user variables on the command line?
I'd like to do this to enable me to parameterised a mysql script.
I'd like to be able to use a command line such as:
mysql @uservar1=1 @uservar2=2 < parameterised_script.sql
So far the best I can find is to prepare a separate script
(parameters.sql) containing only the parameters:
SET @uservar1=1;
SET @uservar2=2;
....
and then pipe both scripts to mysql using cat.
cat parameters.sql parameterised_script.sql | mysql
Is there a neater way?
--
Keith Wall
keith <atsign> wall-uk <dot> org
PGP Key available: http://pgp.mit.edu/