mysql连接的端口号默认是3306,而不是80

解决方案 »

  1.   

    mysql_connect("$host","$user","$password") or die(mysql_error());
      

  2.   

    我改成ip了,是这个样子:
    <html>
    <title>My First php</title>
    <body>
    <?php
    $host="localhost";
    $user="root";
    $password="wwwx1000";
    //连接MySQL数据库
    mysql_connect("$host","$user","$password") or die(mysql_error());
    ?>
    </body>
    </html>
    但是结果成了这个样子:
    Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)
      

  3.   

    mysql已经正常起动了
    [root@wcs ~]# /etc/init.d/mysqld status
    mysqld (pid 4079) 正在运行...
    [root@wcs ~]#
      

  4.   

    如果mysql是开启的,那只有一个原因了,那就是你的php没有将mysql编译进来