php开发,浏览野蛮总是显示无法连接数据库,大神帮忙看看代码,拜托拜托!!

<?php
header("Content-type:text/html; default_charset=UTF-8");
require_once('../wx/config.php');
$lnk = mysql_connect($mysql_server_name, $mysql_username, $mysql_password)
or die ('Not connected : ' . mysql_error());

// make foo the current db
mysql_select_db($mysql_database,$lnk) or die ('Can\'t use foo : ' . mysql_error());

    mysql_close($lnk);

?>

<?php
header("Content-type:text/html; charset=UTF-8");
$mysql_server_name='localhost:3306';
$mysql_username='root';
$mysql_password='123456';
$mysql_database='content';
?>

是不是用xampp连接php和mysql还要打开什么吗?

防火墙的3306端口打开了么?用户名密码数据库驱动是否正确。

无法连接数据库提示是什么错误呢?确认帐号密码、数据库都正确的情况下,那你看下xampp集成包中除了web服务启动外,mysql服务启动了吗