用户@'localhost'拒绝访问数据库'' [英] access denied for user @ 'localhost' to database ''

查看:622
本文介绍了用户@'localhost'拒绝访问数据库''的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到很多与此类似的问题.但还找不到与我完全一样的人.不知道在哪里更改这些设置或其他任何帮助,不胜感激.

I'm seeing a lot of of similar questions to this. but can't find one exactly like mine yet. Not sure where to change these settings or anything, any help appreciated.

access denied Access denied for user ''@'localhost' to database ''

这是我页面的开始.

$dbhost = 'localhost'; //unlikely to require changing.
$dbname ='publication'; //modify these
$dbuser = 'username'; //variables 
$dbpass = ''; //// to your installation
$appname = 'application name'; // and preference

mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());

推荐答案

请尝试以下操作:将用户添加到MySQL

如果要外部访问数据库(即网页),则需要授予用户特权.

You need grant privileges to the user if you want external acess to database(ie. web pages).

这篇关于用户@'localhost'拒绝访问数据库''的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆