$link=mysql_connect("localhost","root","123"); if(!$link) echo "连接错误"; else echo "OK!可以连接"; ?>mysql_connect( )函数为:服务器名或IP、用户名,密码。