Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: No connection to Database for metasploit after update - solution

  1. #11
    Quote Originally Posted by zabeehullah View Post
    "db_connect -y /etc/dradis/database.yml" it would be working for every kali 2.0 user.
    DO NOT DO THIS..

    This is linking the use of a 3rd party application (database) into Metasploit & progresql.

    If you are using Kali 2 or kali rolling, use msfdb init
    Code:
    root@kali:~# msfdb init
    Creating database user 'msf'
    Enter password for new role: 
    Enter it again: 
    Creating databases 'msf' and 'msf_test'
    Creating configuration file in /usr/share/metasploit-framework/config/database.yml
    Creating initial database schema
    root@kali:~#
    As you can see - it will create the database file for you /usr/share/metasploit-framework/config/database.yml
    ...if something goes wrong, msfdb reinit
    This is a Kali-Linux support forum - not general IT/infosec help.

    Useful Commands: OS, Networking, Hardware, Wi-Fi
    Troubleshooting: Kali-Linux Installation, Repository, Wi-Fi Cards (Official Docs)
    Hardware: Recommended 802.11 Wireless Cards

    Search: https://www.kali.org/search/
    Documentation: http://docs.kali.org/ (Offline PDF version)
    Bugs Reporting & Tool Requests: https://bugs.kali.org/
    Kali Tool List, Versions & Man Pages: http://tools.kali.org/

  2. #12
    Junior Member
    Join Date
    Feb 2016
    Posts
    6
    What if someone has already used "db_connect -y /etc/dradis/database.yml" ?
    How can they revert the changes?

  3. #13
    Junior Member
    Join Date
    Oct 2014
    Posts
    7
    Quote Originally Posted by g0tmi1k View Post
    DO NOT DO THIS..

    This is linking the use of a 3rd party application (database) into Metasploit & progresql.

    If you are using Kali 2 or kali rolling, use msfdb init
    Code:
    root@kali:~# msfdb init
    Creating database user 'msf'
    Enter password for new role: 
    Enter it again: 
    Creating databases 'msf' and 'msf_test'
    Creating configuration file in /usr/share/metasploit-framework/config/database.yml
    Creating initial database schema
    root@kali:~#
    As you can see - it will create the database file for you /usr/share/metasploit-framework/config/database.yml
    ...if something goes wrong, msfdb reinit

    I'm facing this problem, and i did all that.. but the connection keep failing..

    Code:
    [-] Failed to connect to the database: could not connect to server: Connection refused
    	Is the server running on host "localhost" (::1) and accepting
    	TCP/IP connections on port 5432?
    could not connect to server: Connection refused
    	Is the server running on host "localhost" (127.0.0.1) and accepting
    	TCP/IP connections on port 5432?
    
                                                      
    
                     _---------.
                 .' #######   ;."
      .---,.    ;@             @@`;   .---,..
    ." @@@@@'.,'@@            @@@@@',.'@@@@ ".
    '-.@@@@@@@@@@@@@          @@@@@@@@@@@@@ @;
       `.@@@@@@@@@@@@        @@@@@@@@@@@@@@ .'
         "--'.@@@  -.@        @ ,'-   .'--"
              ".@' ; @       @ `.  ;'
                |@@@@ @@@     @    .
                 ' @@@ @@   @@    ,
                  `.@@@@    @@   .
                    ',@@     @   ;           _____________
                     (   3 C    )     /|___ / Metasploit! \
                     ;@'. __*__,."    \|--- \_____________/
                      '(.,...."/
    
    
    Taking notes in notepad? Have Metasploit Pro track & report
    your progress and findings -- learn more on http://rapid7.com/metasploit
    
           =[ metasploit v4.11.5-2016010401                   ]
    + -- --=[ 1517 exploits - 875 auxiliary - 257 post        ]
    + -- --=[ 437 payloads - 37 encoders - 8 nops             ]
    + -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ]
    
    msf > db_status [*] postgresql selected, no connection
    :\ tks!!

  4. #14
    Junior Member
    Join Date
    Oct 2014
    Posts
    7
    Hey, after 2 days i've found the solution here.

    https://forums.kali.org/showthread.p...mitage-problem

    tks, it worked.

  5. #15
    Junior Member
    Join Date
    May 2016
    Posts
    6
    this is what i use in kali linux rolling hope it helps

    sudo service postgresql start
    sudo msfconsole
    msf>db_connect postgresql

    hope it works

  6. #16
    Junior Member
    Join Date
    Sep 2016
    Posts
    2
    Quote Originally Posted by Ulairi View Post
    Hope that helps someone out there.
    Thank you very much for this post. Even though it's several years old, it solved a problem I had today. And thank you to Kali Linux forums, for leaving old posts like these that are still very helpful.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •