On Fri, 2005-10-21 at 14:34 -0700, Dustin Krysak wrote: > Hi there, I was wondering if it was possible to issue multiple > commands to mysql from a regular command line? For example i know you > can issue a single by the following: > > mysql -u${DB_USER} -p${DB_PASSWORD} -e 'show databases' > > Now what if for example i needed to select a database, then run an > update against it? With a single command it exits back out to a > shell, so there is no chance to issue a 2nd command.
Terminate each command with a semicolon, and you can execute as many as you want. Alternatively, place the SQL that needs executing in file.sql, and do this: mysql -u${DB_USER} -p${DB_PASSWORD} < file.sql Or do this (maybe from a script): echo ${SQL_TO_EXECUTE} | mysql -u${DB_USER} -p${DB_PASSWORD} -- Jasper Bryant-Greene General Manager Album Limited e: [EMAIL PROTECTED] w: http://www.album.co.nz/ p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303 a: PO Box 579, Christchurch 8015, New Zealand -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]