急火急PHP连接数据库失败,该如何处理

WBOY
Release: 2016-06-13 12:58:13
Original
843 people have browsed it

急,火急,PHP连接数据库失败
我下载了一个开源的文件,把数据库文件导入后,怎么连接不到数据库啊
'Connect failed: Access denied for user 'root'@'localhost'
------解决方案--------------------
你得找下源码,修改连接数据库的密码。
------解决方案--------------------
检查用户名或密码是否写错。且用户名有权限。。
------解决方案--------------------

<br />
//servername [服务器名]     :"127.0.0.1:3306"<br />
//sqlname    [mysql用户名]  :"ncmail"<br />
//sqlpassword[mysql用户密码]:"ncmail"<br />
//database   [mysql数据库]  :"ncmail"<br />
$connect = mysql_connect("127.0.0.1:3306","ncmail","ncmail");<br />
		if (!$connect){<br />
			die("服务器连接失败:".mysql_error());<br />
		}<br />
		$conn = mysql_select_db("ncmail",$connect) or die("数据库连接失败!<br/>");<br />
		mysql_query("set names utf8");<br />
Copy after login

------解决方案--------------------
你看你装mysql是的用户名跟密码是什么,然后改成你的用户名跟密码就ok了。
------解决方案--------------------
用户名权限不对。
简单的说,就是你的mysql账户不对。
------解决方案--------------------
账号、密码不匹配

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template