“mysql -v” command line error(linux/ubuntu)

2019-09-11 03:40发布

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$

Any Idea why this is happening?

I only got an error on mysql -v command

Thank you.

1条回答
在下西门庆
2楼-- · 2019-09-11 04:33
   ·   --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.

what you want ? verbose or version ?

if you want server side version, connect to server, send query status;

You should connect server with full args, example:

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

or put the args on ~/.my.cnf

just like mine:

[mysql]
default-character-set=utf8
prompt="\\u@\\h \\r:\\m:\\s > "
user=user
password=DqvQ86ls1VQit617C
host=127.0.0.1
port=3306
查看更多
登录 后发表回答