你的Mysql服务器是在本机吗?如果不是需要将localhost改成mysql服务器ip

解决方案 »

  1.   

    mysql_connect("localhost","用户名","密码");你的mysql服务启动了吗?用客户端可以连上mysql吗?
      

  2.   

    c:\mysql\bin>mysql如果可以进入mysql,就说明服务已启动。如果没有启动,则:
    C:\mysql\bin>mysqld-nt -install
    Service successfully installed.C:\mysql\bin>net start mysql
    MySQL服务已经启动成功。C:\mysql\bin>mysql
    Welcome to the MySQL monitor...
      

  3.   

    还是Warning: MySQL Connection Failed: Unknown MySQL Server Host 'localhost' (2) in C:\phpwork\creat.php on line 10