0

So I'm hacking away at some software and I decide to run the MySQL command

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password';

Then I notice that my Bug tracker uses the same local MySQL server on my development PC.

Well darn ..

Now when I try to use my bug tracker (Mantis), I get an error message.

APPLICATION ERROR #400 Database connection failed. Error received from database was #1045: Access denied for user 'root'@'localhost' (using password: NO). Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.

Previous non-fatal errors occurred. Page contents follow.

SYSTEM WARNING: 'mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: NO)' in 'C:\xampp\htdocs\mantis\library\adodb\drivers\adodb-mysql.inc.php' line 365

I checked inside the php file and that line is where the MySQL connection is established

function _connect($argHostname, $argUsername, $argPassword, $argDatabasename)
    {
        if (!empty($this->port)) $argHostname .= ":".$this->port;

        if (ADODB_PHPVER >= 0x4300)
            $this->_connectionID = mysql_connect($argHostname,$argUsername,$argPassword,
                                                $this->forceNewConnect,$this->clientFlags);
        else if (ADODB_PHPVER >= 0x4200)
            $this->_connectionID = mysql_connect($argHostname,$argUsername,$argPassword,
                                                $this->forceNewConnect);
        else
            $this->_connectionID = mysql_connect($argHostname,$argUsername,$argPassword);

        if ($this->_connectionID === false) return false;
        if ($argDatabasename) return $this->SelectDB($argDatabasename);
        return true;    
    }

Using MySQL Workbench I can see that

SHOW GRANTS;

grants

That first row seems to be the culprit, ... I think ...

Is there a way to revert this?

Thanks :)

sav
  • 2,064
  • 5
  • 25
  • 45
  • It also seems odd that I get an access is denied error message after granting *ALL* privileges – sav Feb 18 '14 at 04:58
  • your error message clearly says `using password: NO`. In other words, your code is not sending one to mysql, and your `grant` clearly sets a password on the account, so you're properly getting denied access. – Marc B Feb 18 '14 at 05:16
  • The bug tracker (mantis) isn't my code so its best not to change that. It seems you are saying that the GRANT ALL privileges statement also adds the requirement of a password. This would be the part I need to change. – sav Feb 18 '14 at 05:32

1 Answers1

0

I've managed to get mantis working again by

SET PASSWORD FOR root@localhost=PASSWORD('');

As recommended here

Community
  • 1
  • 1
sav
  • 2,064
  • 5
  • 25
  • 45