【问题标题】:"mysql -v" command line error(linux/ubuntu)“mysql -v”命令行错误(linux/ubuntu)
【发布时间】:2012-05-16 04:57:54
【问题描述】:
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 命令的错误

谢谢。

【问题讨论】:

    标签: mysql linux ubuntu command-line bitnami


    【解决方案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;

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

    > 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
    

    【讨论】:

    • 感谢您的快速回复。我试过了,还是报错ERROR 2003 (HY000): Can't connect to MySQL server on 'rocksuper.bitnamiapp.com' (110)有什么建议吗?
    • 搜索关键字“mysql error 2003”,你会得到dev.mysql.com/doc/refman/5.5/en/can-not-connect-to-server.html你的/etc/my.cnf怎么样,你确定它启动了吗?
    • 当我尝试 service mysql start 它给了我一条消息说:start: Rejected send message, 1 matched rules; 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") 想知道为什么?,有什么想法吗?
    • 它现在正在运行,但是套接字不存在。在/var/run/mysqld/ 目录中没有mysqld.sock。如何恢复或生成 mysqld.sock?...谢谢
    • /etc/mysql/my.ini 或连接主机名mysql --user... --host=localhost --port=3306
    猜你喜欢
    • 1970-01-01
    • 2017-02-20
    • 1970-01-01
    • 2015-09-06
    • 2016-07-20
    • 2021-09-16
    • 1970-01-01
    • 2020-10-15
    • 2021-01-04
    相关资源
    最近更新 更多