php 创建数据库DVWA的问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20310313/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 03:03:48  来源:igfitidea点击:

Problems with creation of database DVWA

phphtmlmysqldatabasesecurity

提问by Fatima

I am trying to set up Damn Vulnerable Web App (DVWA) (www.dvwa.co.uk).

我正在尝试设置该死的易受攻击的 Web 应用程序 (DVWA) (www.dvwa.co.uk)。

I installed XAMPP according to these instruction : http://www.apachefriends.org/en/xampp-windows.htmlI installed DVWA according to these instructions: http://www.youtube.com/watch?v=GzIj07jt8rM

我按照这些指令安装XAMPP:http://www.apachefriends.org/en/xampp-windows.html我按照这些指令安装DVWA:http://www.youtube.com/watch?v=GzIj07jt8rM

I went to localhost/dvwa and see: Unable to connect to the database.

我去了 localhost/dvwa 并看到:无法连接到数据库。

 mysql_error()

I try to setup database, it shows "Could not connect to the database - please check the config file".

我尝试设置数据库,它显示“无法连接到数据库 - 请检查配置文件”。

The /htdocs/dvwa/config/config.inc.phpfile shows:

/htdocs/dvwa/config/config.inc.php文件显示:

$_DVWA[ 'db_server' ] = 'localhost';

$_DVWA[ 'db_database' ] = 'dvwa';

$_DVWA[ 'db_user' ] = 'root';

$_DVWA[ 'db_password' ] = 'p@ssw0rd';

I tried replacing localhost with 127.0.0.1but it still did not work.

我尝试更换,localhost with 127.0.0.1但它仍然不起作用。

How I can fix this issue?

我该如何解决这个问题?

回答by Akar

I had the same issue with it.

我有同样的问题。

To Fix it

要解决这个问题

You must go to DVWA Directory>>Config>> Open config.inc.php with your favorite text editor.

您必须转到 DVWA Directory>>Config>> 使用您喜欢的文本编辑器打开 config.inc.php。

then for $_DVWA[ 'db_password' ] = 'p@ssw0rd';change the password to ''and then it should be fixed.

然后 $_DVWA[ 'db_password' ] = 'p@ssw0rd';将密码更改为''然后它应该被修复。

回答by Bill Karwin

That error message occurs in DVWA if mysql_connect()fails. Possible reasons include:

如果mysql_connect()失败,则 DVWA 中会出现该错误消息。可能的原因包括:

  • MySQL service is not running. Start the service:

    \xampp\mysql_start.bat
    
  • MySQL service is running on a non-default port. If so, add the port to your hostname:

    $_DVWA['db_server'] = '127.0.0.1:3306'; // or whatever port you use
    
  • Username or password are incorrect. Verify them in XAMPP's phpMyAdmin instance.

  • MySQL 服务未运行。启动服务:

    \xampp\mysql_start.bat
    
  • MySQL 服务在非默认端口上运行。如果是这样,请将端口添加到您的主机名:

    $_DVWA['db_server'] = '127.0.0.1:3306'; // or whatever port you use
    
  • 用户名或密码不正确。在 XAMPP 的 phpMyAdmin 实例中验证它们。

回答by user4820775

Simply Remove the password from the mysql configuration;

只需从 mysql 配置中删除密码;

**$_DVWA[ 'db_password' ] = '';**

like that it'll be work fine.

像这样它会工作正常。

回答by Abhijeet

Open the file /htdocs/dvwa/config/config.inc.phpin a text editor. Find the line $_DVWA[ 'db_port '] = '3306'and make sure the port is 3306.

/htdocs/dvwa/config/config.inc.php在文本编辑器中打开文件。找到该行$_DVWA[ 'db_port '] = '3306'并确保端口是3306.

回答by shubhrant chauhan

you can also give the mysql server password config.inc.php file.

你也可以给mysql服务器密码config.inc.php文件。

suppose my mysql password is 12345so I've changed config.inc.phpfile like

假设我的 mysql 密码是12345这样我改变了config.inc.php文件

$_DVWA[ 'db_server' ] = 'localhost';

$_DVWA[ 'db_database' ] = 'dvwa';

$_DVWA[ 'db_user' ] = 'root';

$_DVWA[ 'db_password' ] = '12345';

回答by VictorV

Record my solution for my issue:

记录我的问题的解决方案:

change

改变

$_DVWA[ 'db_server' ]   = '127.0.0.1';
$_DVWA[ 'db_database' ] = 'dvwa';
$_DVWA[ 'db_user' ]     = 'root';
$_DVWA[ 'db_password' ] = 'p@ssw0rd';

to

$_DVWA[ 'db_server' ]   = 'localhost';
$_DVWA[ 'db_database' ] = 'dvwa';
$_DVWA[ 'db_user' ]     = 'root';
$_DVWA[ 'db_password' ] = '';

回答by user8506736

To create a database with mysqluse:

要使用创建数据库mysql

mysql -u root -p

use mysql;

create database dvwa;

回答by Mendigo dos Bytes

Try to set your mariaDB root password to the same password of DVWA ($_DVWA[ 'db_password' ]) config.inc.php. To do that follow the steps described at Step 4 — Changing the Root Passwordat: https://www.digitalocean.com/community/tutorials/how-to-reset-your-mysql-or-mariadb-root-password

尝试将您的 mariaDB root 密码设置为与 DVWA ( $_DVWA[ 'db_password' ]) config.inc.php相同的密码。为此,请按照步骤 4 — 更改 Root 密码中所述的步骤操作https: //www.digitalocean.com/community/tutorials/how-to-reset-your-mysql-or-mariadb-root-password

Also, executes the steps described at: https://github.com/ethicalhack3r/DVWA#database-setup

此外,执行以下所述的步骤:https: //github.com/ethicalhack3r/DVWA#database-setup

More especifically:

更具体地说:

mysql> create database dvwa;
Query OK, 1 row affected (0.00 sec)

mysql> grant all on dvwa.* to dvwa@localhost identified by 'xxx';
Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

So Stop all the xampp modules, quit xampp, open again, start and try again.

所以停止所有 xampp 模块,退出 xampp,再次打开,启动并重试。

Good luck!

祝你好运!

Att.,

JLU.

JLU。

回答by DA12C 917

I have provided a detailed explanation on StackExchange. The link is as followed.

我已经在 StackExchange 上提供了详细的解释。链接如下。

https://security.stackexchange.com/a/48125/36726

https://security.stackexchange.com/a/48125/36726

Quick fix:

快速解决:

  1. Stop the XAMPP control panel.

  2. Go to ..\XAMPP\mysql

  3. Find resetroot.bat and execute it.

  4. Proceed with entering random key when prompted.

  5. Restart XAMPP control panel.

  1. 停止 XAMPP 控制面板。

  2. 转到 ..\XAMPP\mysql

  3. 找到resetroot.bat并执行。

  4. 出现提示时继续输入随机密钥。

  5. 重新启动 XAMPP 控制面板。

Now, when you try to connect to DVWA, the browser should land you on the Login Page.

现在,当您尝试连接到 DVWA 时,浏览器应该会让您进入登录页面。

Good Luck !

祝你好运 !