简体   繁体   English

mysql_connect():用户'user'@'localhost'的访问被拒绝

[英]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.

相关问题 mysql_connect():用户&#39;root&#39;@&#39;localhost&#39;的访问被拒绝 - mysql_connect(): Access denied for user 'root'@'localhost' mysql_connect():用户&#39;mss&#39;@&#39;localhost&#39;拒绝访问 - mysql_connect(): Access denied for user 'mss'@'localhost' mysql_connect():用户“ root”的访问被拒绝 - mysql_connect(): Access denied for user 'root' PHP警告mySql_connect()第4行对用户&#39;a34525_user&#39;@&#39;localhost&#39;的访问被拒绝(使用密码:是) - PHP Warning mySql_connect() Access denied for user 'a34525_user'@'localhost' (using password: YES) on line 4 mysql_connect():拒绝用户“ user” @“ host”的访问(使用密码:NO) - mysql_connect(): Access denied for user 'user'@'host' (using password: NO) 警告:mysql_connect():用户&#39;root&#39;@&#39;localhost&#39;拒绝访问(使用密码:YES) - Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES) mysql_connect(): 用户 &#39;adminryan&#39;@&#39;localhost&#39; 访问被拒绝(使用密码:YES) - mysql_connect(): Access denied for user 'adminryan'@'localhost' (using password: YES) WebsitePanel-mysql_connect():第38行对用户&#39;user&#39;@&#39;localhost&#39;的访问被拒绝(使用密码:是)。连接到mysql时出错 - WebsitePanel - mysql_connect(): Access denied for user 'user'@'localhost' (using password: YES) on line 38. Error connecting to mysql mysql_connect()访问被拒绝 - mysql_connect() access denied mysql_connect:访问被拒绝 - mysql_connect: Access denied
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM