2015-09-12 79 views
0

执行我运行在命令行下面的查询中Raspbian时输出帮助/选项:的MySQL命令行

mysql -u $NAME -p $PASS Tweets -e "SELECT count(*) FROM raw_tweets;" 

而且它输出以下。我确定这是一个设置的地方,但我所有的搜索都没有结果。先谢谢您的帮助。

MySQL的版本14.14 DISTRIB 43年5月5日,对于使用的readline 6.2 版权(C)2000,2015,Oracle和/或其附属公司Debian的Linux-GNU(armv7l)。版权所有。

Oracle是Oracle Corporation和/或其子公司 子公司的注册商标。其他名称可能是其各自的 所有者的商标。

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. 
        (Defaults to on; use --skip-auto-rehash to disable.) 
    -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. 
    --auto-vertical-output 
        Automatically switch to vertical output mode if the 
        result is wider than the terminal width. 
    -B, --batch   Don't use history file. Disable interactive behavior. 
        (Enables --silent.) 
    --character-sets-dir=name 
        Directory for character set files. 
    --column-type-info Display column type information. 
    -c, --comments  Preserve comments. Send comments to the server. The 
        default is --skip-comments (discard comments), enable 
        with --comments. 
    -C, --compress  Use compression in server/client protocol. 
    -#, --debug[=#]  This is a non-debug version. Catch this and exit. 
    --debug-check  Check memory and open file usage at exit. 
    -T, --debug-info Print some debug info at exit. 
....... (Abbreviated, above should give enough of an example) 
+0

这些变量'$ NAME'和'$ PASS'是在哪里定义的?你正在使用Linux或Windows? –

+0

您的查询是否执行? –

+0

实际的用户名和密码在那里,只是省略了它们,而且看起来并没有在这里执行查询。然而,当我启动MySQL并从那里运行它们时,它们的查询确实执行 – ktrip

回答

0

你的语法是差不多吧,你忘了添加数据库名称参数。试试这个:

mysql -u $NAME -p $PASS -e "SELECT count(*) FROM raw_tweets" yourDBname 

如果Tweets是你的数据库名称,试试这个:

mysql -u $NAME -p $PASS -e "SELECT count(*) FROM raw_tweets" Tweets 

$NAME$PASS是两个数据库和表授予您的用户名和密码。

不需要分号。如果您只运行一个选择命令。

+0

不幸的是,这产生了相同的输出。我研究的其他语法包括要执行的语句之前的数据库名称,它似乎移动它没有影响 – ktrip

+0

什么是您的MySql版本? –

+0

mysql Ver 14.14 Distrib 5.5.43,用于使用readline 6.2的debian-linux-gnu(armv7l) – ktrip