METASPLOIT ERROR LOCALHOST
msfconsole
[-] 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?
FULLY WORKING SOLUTION
Type the following commands
1.root@kali:~# cd /usr/share/metasploit-framework/config/
2.root@kali:/usr/share/metasploit-framework/config# ls
application.rb database.yml database.yml.vagrant
boot.rb database.yml.example environment.rb
cucumber.yml database.yml.travis environments
3.root@kali:/usr/share/metasploit-framework/config# cat database.yml
development:
adapter: postgresql
database: msf
username: msf
password: 2OjgyhT0tacdnxrYIKC8BgDel7tbY=
host: localhost
port: 5432
pool: 5
timeout: 5
production:
adapter: postgresql
database: msf
username: msf
password: 2O/UYGBP3jgyjgYuIT0tacdnxrYIKC8BgDel7tbY=
host: localhost
port: 5432
pool: 5
timeout: 5
test:
adapter: postgresql
database: msf_test
username: msf
password:
2O/UYGBP3nAhfhffhhyfh0tacdnxrYIKC8BgDel7tbY=
host: localhost
port: 5432
pool: 5
timeout: 5
NOW CHANGE THE PORT NUMBER FROM 5432 TO 5433
THIS IS THE MAIN STEP SO DON'T MISS IT
4.root@kali:/usr/share/metasploit-framework/config# nano database.yml
5.root@kali:/usr/share/metasploit-framework/config# cp database.yml /root/.msf4/
6.root@kali:/usr/share/metasploit-framework/config# cd ~/.msf4/
7.root@kali:~/.msf4# ls
database.yml history local logos logs loot modules plugins
8.root@kali:~# /etc/init.d/postgresql start
9.root@kali:~# msfconsole