当前位置: 动力学知识库 > 问答 > 编程问答 >

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

问题描述:

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

I get this error

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 ......

this is config file

<?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());

}

?>

This is one warning is at phpmyadmin

网友答案:

Using phpmyadmin you cannot have a user with an empty password which instead is allowed in mysql.

网友答案:

The error doesn't seem to be in the config file. ODBC is the default user when none is specified, so since everything seems good in the config file it appears it's either not being included before the call to mysql_query or that the mysql_query call itself is being done wrong.

Without more code there's no real way to know.

网友答案:

i think you don't have problem with config file.i think problem with adding a config file or including a config file.i suggest u to check link that include or add config file.

网友答案:

try to given access table to user :

grant all On [tabelName] to [userName];

example

grant all On mysql.* to root;
分享给朋友:
您可能感兴趣的文章:
随机阅读: