Issue 1 Recurrence Path:
1. Terminal input Msfconsole, enter the MSF command line mode, need to wait several minutes;
2. Enter Db_status, check the connection status, two results: one, the default connection msf3; two, no connection, display PostgreSQL selected, no connection
3. Create a connection database Msfbook, enter Db_connect postgres:[email Protected]/msfbook
Phenomenon:
No information displayed, input Db_status view, still not connected
Analysis:
No associated account and password, so unable to connect
Solution:
1. In the # command line mode, enter Sudo-u postgres psql postgres//To create the account
2. You will enter the postgres= #模式下, enter alter user postgres with password ' toor '; To change the password
3. Show alter ROLE//modification takes effect
4. Exit postgres= #模式, re-enter Db_connect Postgres:[email Protected]/msfbook, there will be a lot of verbose information, this is the process of creating a connection data table, This is only a lengthy message when you first create a Postgres Msfbook library, and then no more, just go back to the MSF terminal prompt.
Tips:
Remember to start the PostgreSQL and Metasploit services before entering Msfconsole, with the following commands:
1. Service PostgreSQL start
2. Service Metasploit Start
Issue 2 Phenomenon:
Following the steps above to create a connected database, the MSF prompts you to create a database encoding error, "error while running command db_connect:failed to connect to the Database:pg::inva LidParameterValue:ERROR:new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII) HINT: Use the same encoding as on the template database, or use TEMPLATE0 as template.: CREATE database "msfbook" encoding = ' u Tf8 ' Call stack: ... '
Analysis:
Default database encoding Issues
Solution:
1. Sudo-u postgres psql postgres//Enter the Postgres user PostgreSQL database mode
2. Enter CREATE database Msfbook with encoding= ' sql_ascii ';
3. Show create DATABASE//created successfully
[Kali_metasploit]db_connect a solution that cannot be connected when creating a connection