Home >Backend Development >PHP Tutorial >php已经支持Mysql,但是一连接数据库就显示无法连接?咋回事、

php已经支持Mysql,但是一连接数据库就显示无法连接?咋回事、

WBOY
WBOYOriginal
2016-06-13 10:25:091142browse

php已经支持Mysql,但是一连接数据库就显示无法连接?怎么回事、??
phpinfo()里已经有mysql.但是
$a="localhost";
$b="root";
$c="root";
$connect=mysql_connect($a,$b,$c);
if($connect){echo "aaaaa";}
else echo "bbbb";
//mysql_select_db("user");
//$wa="select * from user";
//mysql_query($wa);



?>
这样就显示无法连接网页。。也不说连接与否。。。高手解释一下

------解决方案--------------------
代码是没问题,我这里是成功的,你确定你的环境是安装成功,路径等配置正确。数据库启动正常。
------解决方案--------------------
apache开启 了吗?
------解决方案--------------------
看一下apache的log文件

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn