I am trying to do some simple statistics on data I am pulling from a database, but whenever I execute the mysql command all I get is the mysql usage listing. What is confusing to me is this command works from the command line, but not from inside my ruby script.
Command:
query = 'select * from builds;'
results = `mysql -h <hostname> -u root -D build -e #{query}`
print results
I want to see everything in that table, but what I get is this:
mysql Ver 14.12 Distrib 5.0.37, for Win32 (ia32) Copyright (C) 2002 MySQL AB This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL license Usage: mysql [OPTIONS] [database]
-?, --help Display this help and exit. -I, --help
Synonym for -? --auto-rehash
Enable automatic rehashing. One doesn't need to use 'rehash' to get table and field completion, but startup and reconnecting may take a longer time. Disable with --disable-auto-rehash. -A, --no-auto-rehash No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect. WARNING: options deprecated; use --disable-auto-rehash instead. -B, --batch Don't use history file. Disable interactive behavior.
...etc
any help would be great. Thanks.