Thursday, 23 June 2011

No Active Driver when you type in db_driver or db_connect?

Do you get the following error message when you type in db_driver on Metasploit console on BlackTrack5?

[*] No Active Driver
[*]        Available:

[*]     DB Support: Enable the mysql driver with the following command:
[*]                 $ gem install mysql
[*]     This gem requires mysqlclient headers, which can be installed on Ubuntu with:
[*]                 $ sudo apt-get install libmysqlclient-dev

[*]     DB Support: Enable the postgresql driver with the following command:
[*]                   * This requires libpq-dev and a build environment
[*]                 $ gem install postgres
[*]                 $ gem install pg # is an alternative that may work

msf >

And you have tried installing mysql driver but didn't solve the problem ?

This happens because when you start msfconsole by /pentest/exploits/framework3/msfconsole, it does not set the environment variables properly

So all you have to do is, start msfconsole using BT5 menu or by using /usr/local/bin/msfconsole


  1. You're a lifesaver, thanks!

  2. after gem, updates, diving into .rb files, this simple tip saved me.
    how could you find this?
    congrats for you!

  3. Thanks for the tip! I was starting to get a bit frustrated about this particular issue..

  4. I don't use backtrack. Which env variables do I need?

  5. Thanks from the bottom of my heart.......after so many errors this tip worked like charm

  6. why mysql won't show

    msf > db_driver
    [-] The db_driver command is DEPRECATED

    Because Metasploit no longer supports databases other than the default
    PostgreSQL, there is no longer a need to set the driver. Thus db_driver
    is not useful and its functionality has been removed. Usually Metasploit
    will already have connected to the database; check db_status to see.

    [*] postgresql connected to msf3dev
    msf >

  7. You're rock. Thanks you so much