Question

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 :)

Was it helpful?

Solution

I've managed to get mantis working again by

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

As recommended here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top