2012-05-16 58 views
0
[email protected]:~/.rvm/gems$ ruby -v 
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux] 

[email protected]:~/.rvm/gems$ rails -v 
Rails 3.2.3 

[email protected]:~/.rvm/gems$ mysql --version 
mysql Ver 14.14 Distrib 5.5.22, for debian-linux-gnu (x86_64) using readline 6.2 

[email protected]:~/.rvm/gems$ mysql -v 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) 
[email protected]:~/.rvm/gems$ 

任何想法爲什麼會發生這種情況?「mysql -v」命令行錯誤(linux/ubuntu)

我只mysql -v命令

謝謝你得到一個錯誤。

回答

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 

或將args是~/.my.cnf

剛像我的:

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

謝謝你的快速回復。我嘗試了它,但仍然出現錯誤ERROR 2003(HY000):無法連接到'rocksuper.bitnamiapp.com'(110)' 上的任何建議? –

+0

搜索關鍵字「mysql error 2003」,你會得到http://dev.mysql.com/doc/refman/5.5/en/can-not-connect-to-server.html 你的/ etc/my如何? cnf,你確定它開始了嗎? –

+0

當我嘗試'服務mysql啓動'它給了我一個味精,說:'開始:拒絕發送消息,1匹配的規則; type =「method_call」,sender =「:1.61」(uid = 1000 pid = 22761 comm =「start mysql」)interface =「com.ubuntu.Upstart0_6.Job」member =「Start」error name =「(unset)」 requested_reply =「0」destination =「com.ubuntu.Upstart」(uid = 0 pid = 1 comm =「/ sbin/init」)'不知道爲什麼? –