...

View Full Version : Access denied for user 'ODBC'@'localhost' (using password: NO)



jbk_1
01-21-2005, 03:46 PM
Hey guys,
I am using windows XP Pro edition. I have installed MySQL version 4.1.9, Apache 2.0 and PHP 4.3.10.

I have been trying to install this chat system called bribble, web address http://www.bribble.com. It accesses MySQL server and then reads/writes to a database in it. However, when I enter the string for connecting to it using php, I get this error "Access denied for user 'ODBC'@'localhost' (using password: NO)". Browsing around a few forums tells me that this is some bug in the newer versions of MySQL. Anyways here is the string in the php file

$db_host = "localhost"; // database host
$db_name = "bribble"; // database name
$db_login = "root"; // database user
$db_pass= "*****"; // database password

This is the code that I have put in another file.

$db = mysql_connect($db_host, $db_login, $db_pass);
mysql_select_db($db_name,$db);

I know for a fact that the MySQL server works fine, the root has been set up with a password that I enter. And then I get the error message. Any ideas for getting round this one?

Regards,

Jay

Horus Kol
01-21-2005, 04:11 PM
I have seen this, and fixed it before - but i can't remember how, I'm afraid...

I'll think about it and get back to you.


as an extra consideration, though - using the "root" user is a security hole...

jbk_1
01-21-2005, 04:30 PM
Some of the fixes have been to install older versions...but I think thats not really a solution. Also, there was some mention of mysqli_connect instead of mysql_connect thats noticed in PHP 4/5 but I am not quite sure how I go about ensuring this in a windows installation as you need to type in some command.

Anyways, thank you in advance


Regards,

Jay

Horus Kol
01-21-2005, 05:19 PM
if you open the user table and look at the password for the user, is there * character at the start of it?

jbk_1
01-21-2005, 05:25 PM
No there isnt.


Regards,

Jay

bcarl314
01-21-2005, 10:20 PM
"Access denied for user 'ODBC'@'localhost' (using password: NO)"


This message does not seem to go with the code you supplied. My guess is your succesfully connecting with the code you're using, but somewhere else in the script you're trying to connect with the user "ODBC" and no password. Search your code for the string "ODBC" and I'll be you fix the problem.

jbk_1
01-22-2005, 04:40 AM
I did do that but didnt find any code to do with any user "ODBC". Plus I think that this code is the only place where the connection is made.


Regards,

Jay

Horus Kol
01-25-2005, 10:41 AM
"ODBC"@"localhost" is the default user...

sorry, i think i just found the error:



This is the code that I have put in another file.

$db = mysql_connect($db_host, $db_login, $db_pass);
mysql_select_db($db_name,$db);

if those variables are set in a different file, you should be using the GLOBAL array to reference them:



$db = mysql_connect($GLOBALS['db_host'], $GLOBALS['db_login'], $GLOBALS['db_pass']);
mysql_select_db($GLOBALS['db_name'], $db);

stunlaw6
03-07-2005, 07:39 PM
hi i get that access denied error msg when i just do things like

shell> mysql -u root

and i read the post that asked whether the password for the user had a * in front and i looked at my password and it was *<trashtrash> so what do i do to fix this error?

thanks
brian

Cansler
03-23-2005, 09:53 PM
Brian, you probably have a root password set. If that is the case, try:

c:\mysql -u root -p

or

c:\mysql -u root --password="yourpassword"

without the quotation marks.

mike_png
02-19-2006, 09:38 AM
Hi Guys,

I have the same problem with JBK_1 and I have been using the same code in the lower versions of PHP(4 series) and MySql (4 series). It's working in those versions, however, not in the versions of PHP 5 and MySql 5(I am also using the latest version of Apache for MySql 5 and PHP 5).
I can access the MySql in the command prompt and manipulate the database but when I am accessing the MySql using the commands of PHP or the PHP Script, I am getting the access denied for user 'ODBC'@'localhost'(using password:NO).
When I tried creating a database using phpmyadmin, It works... I can create a database and manipulate the data(adding and deleting). It is a PHP software, however, the script for connecting and manipulating data from this software is quite techy and I can't decifer it anymore.
Can anyone give us a light from this problem.....

Thanks:confused:

mike_png
02-19-2006, 09:46 AM
Hi Guys,

try putting this problem to a search engine (I used Yahoo!) using this sentence: Access denied for user 'ODBC'@'localhost' (using password: NO) .
You will see that there are sites with same problem. No text comming out from their site but only these words and a set of common warning messages from the PHP. I hope they are aware of this.

Digger3000
02-25-2006, 09:14 PM
if you open the user table and look at the password for the user, is there * character at the start of it?
I'm having the same problems and there is a * at the start of my password. What does that mean?

[_bushido_]
02-26-2006, 02:43 AM
Hey guys,
I am using windows XP Pro edition. I have installed MySQL version 4.1.9, Apache 2.0 and PHP 4.3.10.

I have been trying to install this chat system called bribble, web address http://www.bribble.com. It accesses MySQL server and then reads/writes to a database in it. However, when I enter the string for connecting to it using php, I get this error "Access denied for user 'ODBC'@'localhost' (using password: NO)". Browsing around a few forums tells me that this is some bug in the newer versions of MySQL. Anyways here is the string in the php file

$db_host = "localhost"; // database host
$db_name = "bribble"; // database name
$db_login = "root"; // database user
$db_pass= "*****"; // database password

This is the code that I have put in another file.

$db = mysql_connect($db_host, $db_login, $db_pass);
mysql_select_db($db_name,$db);

I know for a fact that the MySQL server works fine, the root has been set up with a password that I enter. And then I get the error message. Any ideas for getting round this one?

Regards,

Jay

use single quotes...



<?php
$db_host = 'localhost'; // database host
$db_name = 'bribble'; // database name
$db_login = 'root'; // database user
$db_pass= '*****'; // database password
?>

varg300
10-24-2007, 11:05 PM
It is likely that the client is using the old paasword alogaritm. if the SQL server is newer than 4.1 and PHP is older that 5, you will get this problem.

A goos work-around is to change the password alogharitm to the old one.

to do so, open the SQL command line.
type your password.

the promt says MYSQL>

then type in this (The red is what you shall type)


MYSQL> set password for
-> some_user@localhost = OLD_PASSWORD('some_password');



replace some_user and some_password with the username and the password you want.

fl00d
10-25-2007, 03:10 AM
I have this problem sometimes. I set the username and password I want to use, it gets written to the file, but it tells me its wrong! Crazy computers!
Anyways I found just using root as the username and leaving the password blank worked.



$db_host = "localhost";
$db_login = "root";
$db_pass = ""; //leave the password blank

$db = mysql_connect("$dbhost","$db_login","$db_pass");

CFMaBiSmAd
10-25-2007, 04:07 AM
Ummm. This thread was started in 2005. It was hijacked in 2006 by a series of posts that might or might not have been the same problem.

The problem the OP had is likely due to a mysql_query() being executed without there being a connection to the mysql server. The posted code had no error checking logic and it is unlikely the the posted error message was output by the posted code. The posted error message is output by the mysql_error() function.

The posted code likely failed to connect to the mysql server (apparently due to variable scope problem, but it could have been anything), resulting in no link to the mysql server.

When a mysql_query() is blindly executed and there is no link to a mysql server, a link is attempted using all default values. From the php manual -

link_identifier
The MySQL connection. If the link identifier is not specified, the last link opened by mysql_connect() is assumed. If no such link is found, it will try to create one as if mysql_connect() was called with no arguments. If by chance no connection is found or established, an E_WARNING level warning is generated.

Under this condition, the mysql_error() outputs the posted error message (just tested) -
Access denied for user 'ODBC'@'localhost' (using password: NO)
If the OP was using full php error reporting or had been advised to do so (or checked his web server log), he would have found the following more specific information to help pin down where in the code and what was going on -

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

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in ...\hisfile.php on line xSome of the later posts might have in fact been due to a php/mysql client version problem, but the mysql_error() output and the mysql command line output in this case is something very specific like -
Client does not support authentication protocol requested
by server; consider upgrading MySQL clientSomeone also "guessed" at this being a single-quote/double-quote problem (wrong-o.)

The moral of this thread, use full php error reporting, use program logic to check function calls to find out if they succeeded or failed, and use mysql error checking to get php/your logic/mysql to tell you as much as possible about what they find when your code and queries execute. This will save you a lot of time in finding why your code is not working.

radeoflier
12-27-2007, 04:40 AM
I had this same problem and it was a rookie mistake...

the thing was that I had my $db_connect in a separate file and my $host/$username/$password referenced there but had declared them in a separate doc with all of my site globals (config.php). Anyway, the variables were declared in a file that wasn't referenced in the database.php doc...

I'm sure it's probably not that, but just in case, there's my rookie post...

best all,
-b

Luke7366
10-31-2009, 10:18 PM
I had the same problem:mad:, and when I checked into the include files:rolleyes:, I noticed that I used short tags as <? instead of <?php, when I changed into the long form tag, it just worked fine.:thumbsup:


I hope it will be the same for you

Keep on rockin':cool:
Luke7366

vxpro
06-30-2011, 07:10 AM
Ok, for anyone that is still waiting for an answer on this one. It isn't a php error, it actually isn't even a MySQL error. Essentially what you have done is installed MySQL on a Windows Server, or a Windows operating system. In order to speak to the MySQL installation remotely, you HAVE to let windows know to listen for requests to the MySQL application. In order to do that, you have to add an exception to the windows firewall. If your windows firewall will let you, just open port 3306, if the windows firewall will only allow communications through an application, then you need to locate your MySQL installation directory (usually: C:\Program Files\MySQL\MySQL Server 5.5\bin) but the MySQL Server 5.5 is actually whatever version of MySQL you are running.
Once you locate that folder just find the file mysqld - add that program as the new application for the window firewall to listen through, and then try to connect. ;)

slavinzing56
07-04-2011, 11:05 AM
Ok, for anyone that is still waiting for an answer on this one. It isn't a php error, it actually isn't even a MySQL error. Essentially what you have done is installed MySQL on a Windows Server, or a Windows operating system. In order to speak to the MySQL installation remotely, you HAVE to let windows know to listen for requests to the MySQL application. In order to do that, you have to add an exception to the windows firewall. If your windows firewall will let you, just open port 3306, if the windows firewall will only allow communications through an application, then you need to locate your MySQL installation directory (usually: C:\Program Files\MySQL\MySQL Server 5.5\bin) but the MySQL Server 5.5 is actually whatever version of MySQL you are running.
Once you locate that folder just find the file mysqld - add that program as the new application for the window firewall to listen through, and then try to connect. ;)
I agree with you
Regards

Joanne



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum