linux 环境,PHP连接MYSQL不上,用localhost可以,但是用127.0.0.1连接不上,是什么原因?
host改为localhost可以连接,用127.0.0.1就连接不上了。

解决方案 »

  1.   

    给/etc/hosts里面添加:
    127.0.0.1 localhost
      

  2.   

    [root@wsllinux ~]# vi /etc/hosts
    # Do not remove the following line, or various programs
    # that require network functionality will fail.
    127.0.0.1       localhost.localdomain   localhost       wsllinux
    ~
    ~
    有的。
      

  3.   

    启动的时候显示:
    Timeout error occurred trying to start MySQL Daemon.
    log:
    081115 00:00:58  mysqld started
    081115  0:01:00  InnoDB: Database was not shut down normally!
    InnoDB: Starting crash recovery.
    InnoDB: Reading tablespace information from the .ibd files...
    InnoDB: Restoring possible half-written data pages from the doublewrite
    InnoDB: buffer...
    081115  0:01:00  InnoDB: Starting log scan based on checkpoint at
    InnoDB: log sequence number 0 43634.
    InnoDB: Doing recovery: scanned up to log sequence number 0 43634
    081115  0:01:00  InnoDB: Flushing modified pages from the buffer pool...
    081115  0:01:00  InnoDB: Started; log sequence number 0 43634
    /usr/libexec/mysqld: ready for connections.
    Version: '4.1.11'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution
    081115  0:01:47 [Note] /usr/libexec/mysqld: Normal shutdown081115  0:01:47  InnoDB: Starting shutdown...
    081115  0:01:48  InnoDB: Shutdown completed; log sequence number 0 43634
    081115  0:01:48 [Note] /usr/libexec/mysqld: Shutdown complete081115 00:01:48  mysqld ended081115 00:23:25  mysqld started
    081115  0:23:26  InnoDB: Started; log sequence number 0 43634
    /usr/libexec/mysqld: ready for connections.
    Version: '4.1.11'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution
    081115 00:30:36  mysqld started
    081115  0:30:36 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
    081115  0:30:36 [ERROR] Do you already have another mysqld server running on port: 3306 ?
    081115  0:30:36 [ERROR] Aborting081115  0:30:36 [Note] /usr/libexec/mysqld: Shutdown complete081115 00:30:36  mysqld ended081115 00:34:36  mysqld started
    081115  0:34:36 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
    081115  0:34:36 [ERROR] Do you already have another mysqld server running on port: 3306 ?
    081115  0:34:36 [ERROR] Aborting081115  0:34:36 [Note] /usr/libexec/mysqld: Shutdown complete
      

  4.   

    我才发现你的帖子发了两次!执行一下命令:
    kill -9 `ps aux | grep 3306 | grep -v 'grep' | awk '{print $2}'`完了后再重新启动MySQL就可以了。 
      

  5.   

    arguments must be process or job IDS