“mysql -v”命令行错误(linux / ubuntu)

时间:2012-05-16 04:57:55

标签: mysql linux ubuntu command-line bitnami

bitnami@ip-10-99-67-123:~/.rvm/gems$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

bitnami@ip-10-99-67-123:~/.rvm/gems$ rails -v
Rails 3.2.3

bitnami@ip-10-99-67-123:~/.rvm/gems$ mysql --version
mysql  Ver 14.14 Distrib 5.5.22, for debian-linux-gnu (x86_64) using readline 6.2

bitnami@ip-10-99-67-123:~/.rvm/gems$ mysql -v
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
bitnami@ip-10-99-67-123:~/.rvm/gems$

任何想法为什么会这样?

我只在mysql -v命令

上出错

谢谢。

1 个答案:

答案 0 :(得分:1)

   ·   --verbose, -v

       Verbose mode. Produce more output about what the program does. This option can be given multiple times to produce more and more output. (For example, -v -v -v produces table output format even in
       batch mode.)

   ·   --version, -V

       Display version information and exit.
你想要什么?详细或版本?

如果您需要服务器端版本,请连接到服务器,发送查询status;

您应该使用完整的args连接服务器,例如:

> mysql --user=user --password=password --host=serverip

或将参数放在~/.my.cnf

就像我的一样:

[mysql]
default-character-set=utf8
prompt="\\u@\\h \\r:\\m:\\s > "
user=user
password=DqvQ86ls1VQit617C
host=127.0.0.1
port=3306