Thread: MySQL

  1. #1
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    MySQL

    I've been installing a MySQL database on my computer (just for fun, or whatever ^^). I've noticed that if you try to connect to it with any username but with no password it still accepts the connection, whether the username exists or not. Can this be prevented in some way?

    Another thing I noticed is if you try to connect to it (through PHP's mysql_connect() ) and supply a username with an invalid password you get an error message saying somethign about "Access denied for user" but it STILL connects to the database and does its query. Obviously some setting must be wrong but every setup instructions I've read mentions nothing about it.

    I know this aint a MySQL forum, but I don't know of any good ones.
    Code:
    $user="testuser";
    $password="testpass";
    $database="test";
    mysql_connect("localhost", $user, $password);
    @mysql_select_db($database) or die( "Unable to select database");
    $query= " ... "; //Some query, not important
    mysql_query($query);
    mysql_close();
    "testuser" with the password "testpass" is a valid one. If I change the password to something else I get the error message in the generated file, but the query is still done in the database. Why can it still connect even with an invalid password?
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  2. #2
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    I'm sure it's something in the settings of the server. Look through the settings/readme files for the server. And you might want to post this over on www.flashdaddee.com/forums because [EMOBA] usually runs around over there and most likely will know the answer. He's pretty keen on this stuff.

  3. #3
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345
    check out this:
    http://www.mysql.com/doc/en/Access_denied.html

    You need to specify a host and a user combination, the user you are using doesn't have a matching host.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Change detection in MySQL.
    By amitbora27 in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 05-13-2009, 10:34 AM
  2. MySQL libraries
    By csonx_p in forum C++ Programming
    Replies: 6
    Last Post: 10-02-2008, 02:23 AM
  3. About C++ and MySQL or oether free database
    By xxxrugby in forum C++ Programming
    Replies: 18
    Last Post: 12-30-2005, 06:28 AM
  4. Get data from mysql and use in a system.
    By smaakage in forum Tech Board
    Replies: 3
    Last Post: 10-04-2005, 12:03 PM
  5. Get data from mysql and use in a system.
    By smaakage in forum C++ Programming
    Replies: 5
    Last Post: 10-02-2005, 01:25 PM