Access denied for user 'ODBC'@'localhost'

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Access denied for user 'ODBC'@'localhost'

Postby azsl1326 » 10. March 2010 22:10

Hello All,

I just installed XAMPP on my home machine for windows 7. I am trying to access the mysql database using Flex and AMFPHP. I am getting the following error when I attempting to connect via Flex / PHP - Access denied for user 'ODBC'@'localhost' (using password: NO); See PHP code below:

Code: Select all
Access denied for user 'ODBC'@'localhost' (using password: NO)
<?php

   class LightBoxes{

      public function __constructor(){
   
         $connect = mysql_connect("localhost","root","mypassword");
         mysql_select_db("digitalassets",$connect);
         
      }
      
      function read(){
      
         $query = "SELECT * FROM lightboxes_tbl";
         $result = mysql_query($query) or die(mysql_error());
         
         return mysql_error();
         
      }
      
   }
}

?>


'


I have researched this via Google and can not seem to find a solution that will work on my machine - I am also experiencing the same issue on my work machine as well. I set up the user 'root' with a passwor via the XAMPP security page. I currently don't have the user 'ODBC'.

Any information to help resolve this issue is certainly appreciated.
azsl1326
 
Posts: 4
Joined: 10. March 2010 20:09

Re: Access denied for user 'ODBC'@'localhost'

Postby Altrea » 11. March 2010 05:58

ODBC is a default user for the db connection, if no login data is given.

I think the problen is not the class, but the place where you call/use the db connect
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8297
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Access denied for user 'ODBC'@'localhost'

Postby azsl1326 » 11. March 2010 06:04

Thanks for the assistance. Actually I just ended up resolving the issue by doing the following:

Code: Select all
mysql>GRANT ALL ON <your database name>.* TO 'ODBC'@'localhost';


I have never had to do this in the past as I was always able to connect using root and the password.
azsl1326
 
Posts: 4
Joined: 10. March 2010 20:09

Re: Access denied for user 'ODBC'@'localhost'

Postby Altrea » 11. March 2010 06:07

That will not solve all your code problems, but ends up in that every database connect will have all access to your database, which is highly insecure!
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8297
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Access denied for user 'ODBC'@'localhost'

Postby azsl1326 » 11. March 2010 15:43

This is the only solution I could find that would work. I am not too worried about security as it is only for internal use. However, with that said, I would like to find/know the best way to resolve this issue.
azsl1326
 
Posts: 4
Joined: 10. March 2010 20:09

Re: Access denied for user 'ODBC'@'localhost'

Postby Altrea » 11. March 2010 16:26

ah, i get it.

You tried to use a constructor to establish the database connection, but named the method not correctly.

__constructor(...) should be __construct(...), otherwise your constructor will never be called.
Because your class never called the constructor, it tries to use a default connection.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8297
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Access denied for user 'ODBC'@'localhost'

Postby azsl1326 » 11. March 2010 16:45

Altrea wrote:ah, i get it.

You tried to use a constructor to establish the database connection, but named the method not correctly.

__constructor(...) should be __construct(...), otherwise your constructor will never be called.
Because your class never called the constructor, it tries to use a default connection.


That was it!! Thank you very much. I copied the __construct(or) code from another file which I thought was working. Anyway, now it makes sense why it wasn't working.

Thank you again!
azsl1326
 
Posts: 4
Joined: 10. March 2010 20:09

Re: Access denied for user 'ODBC'@'localhost'

Postby Altrea » 11. March 2010 17:00

You're welcome :)
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8297
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Access denied for user 'ODBC'@'localhost'

Postby malt_master » 12. March 2010 09:41

Hi,
I am having the same issue. A newbie here also.

What code and where do I add it to solve the ODBC denied issue?

Thanks IA

Malt
malt_master
 
Posts: 1
Joined: 11. March 2010 13:58

Re: Access denied for user 'ODBC'@'localhost'

Postby Altrea » 12. March 2010 09:47

malt_master wrote:Hi,
I am having the same issue. A newbie here also.

What code and where do I add it to solve the ODBC denied issue?

Thanks IA

Malt


This problem can have many many different reasons.
To solve your specific problem, you had to give us more details of your code.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8297
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 71 guests