How to Fix Metasploit Database Not Connected [Full Guide]

Tools

User Case: Metasploit Database Not Connected

This morning, when opening msfconsole, I encountered the following error: “password authentication failed for user” msf“. Confirmed, the PostgreSQL service has been started, and it is suspected that there may be a problem with Metasploit database not connected.

Metasploit Database Not Connected

Fixing Metasploit Database Not Connected

As the relevant databases have not been used yet, use msfdb delete directly to delete them, and then initialize the relevant settings through the msfdb init command:

After completion, exit msfconsole, service postgresql restart, enter msfconsole again, normal:

Armitage can also be accessed normally, however, it may also be possible to modify and reset the password here through the following process:

  1. Open the postgreSQL service: services postgreSQL start
  2. Enter PostgreSQL, set default user password, create new user, set new user permissions, and create database:

Sudo u postgres psql # Enter the default user for postgreSQL

Alter user postgres with password ‘password’# Set default user login password

Create user ‘username’ wiht password ‘password’ nocreatedb# Create a new user with a password

Create database ‘database name’ with owner=’username’# Create a database and specify the user to whom the database belongs

\q

  1. Enter metasploit and connect to the database:

msfconsole

Db_status # Viewing the Status of a Database

Db_connect username: password @ host address \ database name

Db_status # Check if the startup was successful

Click to rate this post!
[Total: 0 Average: 0]
Share this