Page 1 of 1

Mysql error

PostPosted: 12. May 2015 20:36
by paultheb
Hi I am a noobie
but i have xampp running and want to run the Bwapp application. I have Bwapp in htdocs nut when i log on through local host i get this errror not sure how to fix any advice would be appreciated

Warning: mysqli::mysqli(): (HY000/1049): Unknown database 'bwapp' in C:\xampp\htdocs\bWAPPv2.2\bWAPP\connect_i.php on line 23
Connection failed: Unknown database 'bwapp'

Regards Paul

Re: Mysql error

PostPosted: 12. May 2015 20:48
by mark.mcdonald
http://sourceforge.net/projects/bwapp/ wrote:bWAPP
an extremely buggy web app !

Did you follow every instruction on setting this up?
Did you go here first? http://localhost/bWAPP/install.php
Sounds like you did not install it, you just put it in htdocs and hoped it would work without any setup.

---------------
bWAPP - INSTALL
---------------

It's pretty easy to install bWAPP from scratch...

Another option is to download bee-box.
bee-box is a custom Linux VM (virtual machine) pre-installed with bWAPP.
bee-box gives you several ways to hack and deface the bWAPP website.
It's even possible to hack the bee-box to get root access...
With bee-box you have the opportunity to explore all bWAPP vulnerabilities!

Requirements
////////////

*/ Windows, Linux, Unix, Mac OS,...
*/ a web server (Apache, Nginx, IIS,...)
*/ the PHP extensions
*/ a MySQL installation
*/ (or you could install WAMP or XAMPP)

Installation steps
//////////////////

No! I will not explain how to install Apache/IIS, PHP and MySQL :)

*/ Extract the 'zip' file.

example on Linux:

unzip bWAPP.zip

*/ Move the directory 'bWAPP' (and the entire content) to the root of your web server.

*/ Give full permission to the directories 'passwords', 'images', 'documents' and 'logs'.
This step is optional but it will give you so much fun when exploiting bWAPP with tools like sqlmap and Metasploit.

example on Linux:

chmod 777 passwords/
chmod 777 images/
chmod 777 documents/
chmod 777 logs/

*/ Edit the file 'admin/settings.php' with your own database connection settings.

example:

$db_server = "localhost"; // your database server (IP/name), here 'localhost'
$db_username = "root"; // your MySQL user, here 'root'
$db_password = ""; // your MySQL password, here 'blank'

*/ Browse to the file 'install.php' in the directory 'bWAPP'.

example: http://localhost/bWAPP/install.php

*/ Click on 'here' (Click 'here' to install bWAPP).

The database 'bWAPP' will be created and populated.

*/ Go to the login page. If you browse the bWAPP root directory you will be redirected.

example: http://localhost/bWAPP/
example: http://localhost/bWAPP/login.php

*/ Login with the default credentials, or make a new user.

default credentials: bee/bug

*/ You are ready to explore and exploit the bee!

This project is part of the ITSEC GAMES project. ITSEC GAMES are a fun approach to IT security education.
IT security, ethical hacking, training and fun... all mixed together.
You can find more about the ITSEC GAMES and bWAPP projects on our blog.

We offer a 2-day comprehensive web security course 'Attacking & Defending Web Apps with bWAPP'.
This course can be scheduled on demand, at your location!
More info: http://goo.gl/ASuPa1 (pdf)

Enjoy!

Cheers

Malik Mesellem
Twitter: @MME_IT

Re: Mysql error

PostPosted: 12. May 2015 20:55
by paultheb
can see the foldrsok just the final install browse to the http://localhost/bWAPP/install.php is when i get the error. i have changed mothing on the install just unzipped bwapp in the htdocs folder

P

Re: Mysql error

PostPosted: 12. May 2015 21:05
by mark.mcdonald
PLease display whats in C:\xampp\htdocs\bWAPPv2.2\bWAPP\connect_i.php

Re: Mysql error

PostPosted: 12. May 2015 21:13
by paultheb
I am going to re-install all to make sure no errors in what i have done


Thanks for replies will return with update

Re: Mysql error

PostPosted: 12. May 2015 22:54
by paultheb
I have re-installed have new error. This full re install

Warning: mysqli::mysqli(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in C:\xampp\htdocs\bWAPP\bWAPP\connect_i.php on line 23
Connection failed: Access denied for user 'root'@'localhost' (using password: YES)

I have addes password on localhost/security/index.php.

When i go to localhost/bWAPP i get the bWAPP foder to bring to login.php but get the above error.

Re: Mysql error

PostPosted: 13. May 2015 14:50
by mark.mcdonald
Did you set a password for the root user in the MySQL database? (By default there should be no password)
Did you put a password in this file: C:\xampp\htdocs\bWAPP\bWAPP\connect_i.php?
By default it should look like this:
$db_server = "localhost";
$db_username = "root";
$db_password = ""; (Does yours look any different here than this?)

Re: Mysql error

PostPosted: 13. May 2015 17:54
by paultheb
Warning: mysqli::mysqli(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO) in C:\xampp\htdocs\bWAPP\connect_i.php on line 23
Connection failed: Access denied for user 'root'@'localhost' (using password: NO)

I have re-installed changed bWapp folder to just one folder. And below is the contents of the c/xampp/htdocs/bWAPP/connect_i.php

*/

// Connection settings
include("config.inc.php");

// Connects to the server
$link = new mysqli($server, $username, $password, $database);

// Checks the connection
if($link->connect_error)
{

// @mail($recipient, "Connection failed: ", $link->connect_error);

die("Connection failed: " . $link->connect_error);

}

// $link->close();

?>

I appreciate the help this was set up in wamp but changed to xampp for another project for college then went to put bWAPP on in htdocs and getting the errors

P

Re: Mysql error

PostPosted: 13. May 2015 18:40
by mark.mcdonald
These are the steps I just did and it worked perfectly "out of the box".
0) Make sure no previous versions of xampp/wampp/lamp/skype etc are running on current machine (uninstall any bitnami application, restart machine if worried about port 80 being in use).
1) Download http://sourceforge.net/projects/xampp/f ... e/download and install (clicking "Yes" and "Next" with all default options)
2) Download http://sourceforge.net/projects/bwapp/f ... p/download and unzip to C:\xampp\htdocs
3) Run Xampp Control Panel (already up after the install from step 1) and run Apache and MySQL
4) Go to http://localhost to confirm the setup of xampp
5) Go to http://localhost/bWAPP/install.php and clicked "here" to install (takes seconds to install)
6) Go to http://localhost/bWAPP/login.php using (bee/bug) as credentials
This ran successfully on my machine using Windows 7 x64 from installing both fresh without any prior instances running or changing anything.

Please follow these same steps and tell me if you run into the same issue as before. I don't know if you are just uninstalling bwapp or xampp.
Only a fresh install of both will show what went wrong. Truly hope this helps! Best of luck!

Re: Mysql error

PostPosted: 14. May 2015 11:21
by Nobbie
paultheb wrote:Warning: mysqli::mysqli(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO) in C:\xampp\htdocs\bWAPP\connect_i.php on line 23
Connection failed: Access denied for user 'root'@'localhost' (using password: NO)


This error means, that you must have changed formerly the root password from empty (what is the default after a fresh Xampp Install) to a certain value (we dont know what you choose). You should remember that password, otherwise you will not succeed to connect to MySQL.

As your profile shows, you are using quite an old Xampp version (1.8.3-2). Therefore its quite normal that you may have changed the root password. If you dont remember anything, you may be lucky by looking into config.inc.php in phpmyadmin folder. Maybe you wrote down the password in that configuration file (which is used by phpmyadmin in order to connect to MySQL). If you can find out the password, you have to apply it in the settings.php fle of bWAPP (as shown by mark).

Re: Mysql error

PostPosted: 15. May 2015 10:56
by paultheb
I would like to thank you all for your help. In particular Mark.

I discovered when it wasn`t working the first time i had added a password but when I removed I hadn`t shut down the server so there was an instance with password still working on

So many thanks again