Web lists-archives.com

Re: Dumping database names from bash with exclusion




* hsv@xxxxxxxx <hsv@xxxxxxxx> [150401 15:22]:
> On 2015/04/01 16:09, Tim Johnson wrote:
> >Using Mysql 5 on darwin (OS x).
> >This command
> >SELECT schema_name FROM information_schema.schemata WHERE
> >schema_name NOT IN
> >('mysql','information_schema','performance_schema');
> >as executed from the mysql prompt gives me a dump of all databases
> >except those not included in the tuple.
> >
> >This command
> >mysql -uroot -p****** -e "SELECT schema_name FROM
> >information_schema.schemata WHERE schema_name NOT IN
> >('mysql','information_schema','performance_schema')"
> >
> >gives me a a dump of the entire mysql help screen, _not_ the
> >databases I am after.
> 
> Interesting ... when I try it, I get the output that, I suspect, you 
> want. Since mine is Windows cmd-line, I put it all on one line, but I 
> believe that all Unix-likes let one continue a string until finished.
> When I break the "e"-string off, I get a syntax error, as if entered 
> from the MySQL command prompt, semicolon too soon. I cannot get the 
> output that you describe unless I slip question-mark in.
  Thanks for the reply.

  I haven't gotten any simple -e or --execute= options to work on my
  Mac. I've got a dual-boot setup, so booted into ubuntu 14.04 and
  -e'command' works for any test that I tried. 

  I'd chalk it up to version or an OS difference, and my need is
  easy to be met with another approach.
 
  Cheers
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com, http://www.tj49.com

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql