I know this question has been asked many times, but in all other posts i searched, i just couldn't find the answer. I just cant seem to connect to the database.
My OS is Ubuntu 12.04, if it helps.
Here is my code for config.php:
<?php
define('DB_HOST','localhost');
define('DB_USER','root');
define('DB_PASS','121212aa');
define('DB_NAME','PHP-Wizard');
?>
And also Database.php
<?php
class Database{
public $host = DB_HOST;
public $username = DB_USER;
public $password = DB_PASS;
public $db_name = DB_NAME;
public $link;
public $error;
/*
 * Class Constructor
 */
public function __construct(){
    //Call Connect Function
    $this->connect();
}
/*
 * Connector
 */
 private function connect(){
    $this->link = new mysqli($this->host, $this->username, $this->password, $this->db_name);
    if(!$this->link){
        $this->error = "Connection Failed: ".$this->link->connect_error;
        return false;
    }
 }
 /*
  * Select
  */
  public function select($query){
    $result = $this->link->query($query) or die($this->link->error.__LINE__);
    if($result->num_rows > 0){
        return $result;
    } else {
        return false;
    }
  }
  /*
   * Insert
   */
   public function insert($query){
        $insert_row = $this->link->query($query) or die($this->link->error.__LINE__);
        //Validate Insert
        if($insert_row){
            header("Location: index.php?msg=".urlencode('Record Added'));
            exit();
        } else {
            die('Error : ('. $this->link->errno .') '. $this->link->error);
        }
   }
   /*
   * Update
   */
   public function update($query){
        $update_row = $this->link->query($query) or die($this->link->error.__LINE__);
        //Validate Insert
        if($update_row){
            header("Location: index.php?msg=".urlencode('Record Updated'));
            exit();
        } else {
            die('Error : ('. $this->link->errno .') '. $this->link->error);
        }
   }
    /*
   * Delete
   */
   public function delete($query){
        $delete_row = $this->link->query($query) or die($this->link->error.__LINE__);
        //Validate Insert
        if($delete_row){
            header("Location: index.php?msg=".urlencode('Record Deleted'));
            exit();
        } else {
            die('Error : ('. $this->link->errno .') '. $this->link->error);
        }
   }
And here is the error i get when i try to open index.php
Warning: mysqli::mysqli(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in /opt/lampp/htdocs/Forum/Database.php on line 23
Warning: mysqli::query(): Couldn't fetch mysqli in /opt/lampp/htdocs/Forum/Database.php on line 35
Warning: Database::select(): Couldn't fetch mysqli in /opt/lampp/htdocs/Forum/Database.php on line 35
Any answers as to why i cant connect to the Database?
 
     
     
    