Problems with creation of database DVWA

55,514

Solution 1

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.

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

Solution 2

On my localhost after renaming config.inc.php.dist to config.inc.php and accessing the url http://localhost/dvwa/setup.php I was seeing the error:

Unable to connect to the database.

Followed the steps:

The issue still persisted as:

Could not connect to the database service.
Please check the config file.
Database Error #1045: Access denied for user 'dvwa'@'localhost' (using password: NO).

Solution

Changing the db_user from dvwa to root solved the issue. So effectively you need to change the line:

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

to:

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

Snapshot:

DVWA

Solution 3

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

  • 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.

Solution 4

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' ] = '';

Solution 5

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

Share:
55,514
Fatima
Author by

Fatima

Updated on November 24, 2020

Comments

  • Fatima
    Fatima over 3 years

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

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

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

     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.php file shows:

    $_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.1 but it still did not work.

    How I can fix this issue?