[英]mysql_connect() : Access denied for user 'user'@'localhost'
I am trying to connect to mysql and am getting an error. 我试图连接到mysql并收到错误消息。 I put my servers ip address in and used port 3306 whihch post should be used?
我将服务器的ip地址放入并使用了3306端口,应该使用哪个帖子?
<?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 denied 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)
警告:mysql_connect()[function.mysql-connect]:在/home/admin/domains/domain.com.au/public_html/db_connect.php上对用户'user'@'localhost'的访问被拒绝(使用密码:是)第3行拒绝用户'user'@'localhost'的访问(使用密码:是)
Use 采用
$conn = mysql_connect($db_host,$db_user, $db_pass) or die("Error connecting to database");
The port is automatically selected as 3306. 端口自动选择为3306。
Also double check to make sure your username and password for connecting are correct and allowed access. 还要仔细检查以确保您的用户名和密码正确无误,并允许访问。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.