警告:mysql_query()[function.mysql-query]:用户'ODBC'@'localhost'的访问被拒绝(使用密码:NO) [英] Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO)

查看:379
本文介绍了警告:mysql_query()[function.mysql-query]:用户'ODBC'@'localhost'的访问被拒绝(使用密码:NO)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 7上使用XAMPP,并且当我尝试打开当前项目的login.php时

I'm using XAMPP on Windows 7. and when I try to open a login.php of current project

我收到此错误

Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in E:\xampplite\htdocs\newfule\mcp\clientlist.php on line 19

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in E:\xampplite\htdocs\newfule\mcp\clientlist.php on line 19

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in E:\xampplite\htdocs\newfule\mcp\clientlist.php on line 21
Sorry No entries for the Records of Student ......

这是配置文件

<?php

$link = mysql_connect('127.0.0.1', 'root', '');
if (!$link) {
   die('Not connected : ' . mysql_error());
}

// make foo the current db
$db_selected = mysql_select_db('fueldb', $link);
if (!$db_selected) {
   die ('Can\'t use foo : ' . mysql_error());
}
?>

这是一个警告,位于phpmyadmin

This is one warning is at phpmyadmin

推荐答案

您的错误和您的配置文件未应用相同的用户

Your error and your config file are not appling the same users

警告:mysql_query()[function.mysql-query]:用户'ODBC'@'localhost'的访问被拒绝(使用密码:NO)

Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO)

关于从主机"localhost"查询用户"ODBC"的错误

mysql_connect('127.0.0.1', 'root', '');

将用户"root"连接到"127.0.0.1"

?是否已应用您的配置?似乎"clientlist.php"正在使用其他$link资源

¿Is your configuration applied? It seems that "clientlist.php" is using other $link resource

还考虑了默认情况下mysql用户表中的用户包含主机引用.这意味着 root @ localhost 可以正确无密码访问,但 root@127.0.0.1 可能会被拒绝.

Also take in cosideration that the users in mysql user table contains by default the host reference. This meants that root@localhost could be correct to access without password but root@127.0.0.1 could be denied.

如果已注册的用户具有密码和允许的主机,则可以在"mysql"数据库的用户表中查看.如果主机不同,则每个用户可能会出现多次.也可以在主机中使用字符%"来允许所有主机或子网(但我不建议在生产环境中使用此符号)

You could view in the user table of the "mysql" database the registered users, if they have password and the host (or hosts) allowed. Each user could appear more than once if the host is different. Also is possible to use the character "%" in the host to allow all hosts or a subnet (but i dont recommend this for production environments)

在所有情况下,建议创建一个适当的用户并为所需的数据库赋予特权以对其进行操作.

In all cases is recommended to create a proper user and assing privileges to the desired database to operate it.

这篇关于警告:mysql_query()[function.mysql-query]:用户'ODBC'@'localhost'的访问被拒绝(使用密码:NO)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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