开发者

mysql_connect() : Access denied for user 'user'@'localhost'

I am trying to connect to mysql and am getting an error. I put my servers ip address in and used port 3306 whihch post should be used?

<?php

$connection = mysql_connect("serer.ip:port", "user", "pass")
 or die(mysql_error());

 if ($connection) {$msg = "success";}
?>

<html>
<head>
</head>
<body>

<? echo "$msg"; ?>

</body>
</html>

Here is the error its producing:

Warning: mysql_connect() [function.mysql-connect]: Access d开发者_如何转开发enied for user 'user'@'localhost' (using password: YES) in /home/admin/domains/domain.com.au/public_html/db_connect.php on line 3 Access denied for user 'user'@'localhost' (using password: YES)


Use

$conn = mysql_connect($db_host,$db_user, $db_pass) or die("Error connecting to database");

The port is automatically selected as 3306.

Also double check to make sure your username and password for connecting are correct and allowed access.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜