Web lists-archives.com

Re: Dumping database names from bash with exclusion




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.

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