码迷,mamicode.com
首页 > 数据库 > 详细

[Kali_Metasploit]db_connect创建连接时无法连接的解决方案

时间:2017-11-21 23:55:21      阅读:301      评论:0      收藏:0      [点我收藏+]

标签:创建   出现   ram   数据库   man   asp   输入   postgre   错误   

问题1复现路径:

  postgresql selected, no connection

 第一步: db_connect postgres:toor@127.0.0.1/msfbook

连接成功不需要进行下一步

若失败:

分析:

  没有相关账号和密码,所以无法连接

解决方案:

  1. 在#命令行模式下,输入sudo -u postgres psql postgres // 来创建账号

  2. 就会进入到postgres=#模式下,在msfconsole模式下输入 alter user postgres with password ‘toor‘; // 来修改密码

  3. 显示ALTER ROLE // 修改生效

  4. 退出postgres=#模式,重新输入db_connect postgres:toor@127.0.0.1/msfbook,就会出现一堆冗长的信息,这是创建连接数据表的过程,这只有在第一次创建postgres的msfbook库时出现冗长信息,以后就没有了,直接回到msf终端提示符。

提示:

  记得开始进入msfconsole前,启动postgresql,命令如下:

    1. service postgresql start

 

问题2现象:

  根据以上的步骤进行创建连接数据库后,msf中会提示,创建时数据库编码错误,"Error while running command db_connect: Failed to connect to the database: PG::InvalidParameterValue: ERROR: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII) HINT: Use the same encoding as in the template database, or use template0 as template.: CREATE DATABASE "msfbook" ENCODING = ‘utf8‘ Call stack:......"

分析:

  默认数据库编码问题

解决方案:

  1. sudo -u postgres psql postgres // 进入postgres用户PostgreSQL数据库模式中

  2. 输入 create database msfbook with encoding=‘SQL_ASCII‘;

  3. 显示 CREATE DATABASE // 创建成功

[Kali_Metasploit]db_connect创建连接时无法连接的解决方案

标签:创建   出现   ram   数据库   man   asp   输入   postgre   错误   

原文地址:http://www.cnblogs.com/hwhxy/p/7875714.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!