Search code examples
phpdatabaseconnectionwampserver

How to resolve "The requested URL/mypath was not found on this server?"


i have download wampserver and successfully installed it on my computer. However, when i am trying to connect to my database,it says the following:

Not Found

The requested URL /uomwebapplication/init was not found on this server.

Apache/2.4.9 (Win64) PHP/5.5.12 Server at localhost Port 80.

Help me on this please.

init.php


  <?php
  $db_name="uomwebappdb";
  $mysql_user="root";
  $mysql_pass="root";
  $server_name="localhost";

  $con=mysqli_connect($server_name,$mysql_user,$mysql_pass,$db_name);
  if(!$con)
   {
  echo"Connection Error...".mysqli_connect_error();
   }
  else
  {
  echo"<h3>Database connection Success...</h3>";
 }




 ?>

Solution

  • Ok, by default MYSQL is installed with one user called root and this user has no password, so change this code to

    <?php
      $db_name="uomwebappdb";
      $mysql_user="root";
      $mysql_pass="";          //<-- changed here
      $server_name="localhost";
    
      $con=mysqli_connect($server_name,$mysql_user,$mysql_pass,$db_name);
      if(!$con) {
          echo"Connection Error...".mysqli_connect_error();
      } else {
          echo"<h3>Database connection Success...</h3>";
      }