title: Connecting to MySQL using Apache and PHP
body: <p>i'm currently on Apache 2.2 using PHP 5..
  I am trying to connect to to MySQL on my Apache server and  create a database called my_db...
  and i have the following code:</p>
  
  <pre><code>&lt;?php
  $con=mysqli_connect();
  // Check connection
  if (mysqli_connect_errno()){
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }else{
  echo "Connected Successfully!";
  }
  // Create database
  $sql="CREATE DATABASE my_db";
  if (mysqli_query($con,$sql)){
  echo "Database my_db created successfully";
  }else{
  echo "Error creating database: " . mysqli_error();
  }
  ?&gt; 
  </code></pre>
  
  <p>However, when the script runs i get the following output:</p>
  
  <blockquote>
    <p>Connected Successfully!Error creating database: </p>
  </blockquote>
  
  <p>Please help. It is not an authentication problem since "Connected Successfully!" is printed...</p>
  
  <p>Thankyou in advance!</p>