本帖最后由 netxuning 于 2009-12-04 15:57:40 编辑

解决方案 »

  1.   

    你是如何连上去的,如果在UNIX下通过sock连上去自然没有PORT号。
      

  2.   


    是sock, 启动命令有这样的参数:--socket=/var/lib/mysql/mysql.sock --port=3306
      

  3.   

    换台其它机器通过 tcp/ip 连一下试试。
      

  4.   


    没问题,连接命令是:
    mysql -h 192.168.0.12 -u ruser -P 3306 -p
    而且这台机器一直在进行主从同步!
    主从同步的两个进程均有端口号:+--------+------+------------------+------+-------------+--------+----------------------------------------------------------------+------------------+
    | Id     | User | Host             | db   | Command     | Time   | State                                                          | Info             |
    +--------+------+------------------+------+-------------+--------+----------------------------------------------------------------+------------------+
    |   2449 | ruser | 192.168.0.13:56841 | NULL | Binlog Dump | 246371 | Has sent all binlog to slave; waiting for binlog to be updated | NULL             | 
    | 531488 | ruser | 192.168.0.13:46220 | NULL | Query       |      0 | NULL                                                           | show processlist | 
    +--------+------+------------------+------+-------------+--------+----------------------------------------------------------------+------------------+
      

  5.   

    找到方法了版主:
    mysql -h 127.0.0.1 -u user -p连接的时候,host指定ip则成为了tcp连接,如果是localhost,则为unix socket.这样连接后:mysql> show processlist;
    +--------+------+-----------------+------+---------+------+-------+------------------+
    | Id     | User | Host            | db   | Command | Time | State | Info             |
    +--------+------+-----------------+------+---------+------+-------+------------------+
    | 601258 | root | localhost:55207 | NULL | Query   |    0 | NULL  | show processlist | 
    +--------+------+-----------------+------+---------+------+-------+------------------+
      

  6.   

    http://www.mombu.com/programming/php/t-replace-localhost-unix-socket-connection-by-localhost-tcpip-connection-1367681.htmllocalhost -> Unix socket
    127.0.0.1 -> TCP socket