I just learnt how to connect to a DB. However I intentionally put the wrong user to return an error. But it doesn't, it keeps showing me that I am connected.
<?php
$mysql_host = 'localhost';
$mysql_user = 'root';
$mysql_pass = '';
@mysql_connect($mysql_host,$mysql_user,$mysql_pass) or die('Sorry');
echo 'Connected';
?>
In this case it shows connected because there is a user named root in my DB, but if I replace with anything else, it still shows Connected and not Sorry.
I am not allowed to answer my own question because of less reputation apparently and I was asked to wait for some 8 hours or edit my question and fix it. (I hope you guys give me some ticks so that I can answer too :P Just kidding)
So here is the fix:
When I went to users overview tab under localhost link, it showed "User: Any", "Host: localhost", "Privileges: Usage". I just deleted that thing. And kept the pma, linux and root thing alone. Removed that extra user (don't know how it came) and that fixed the problem.
So basically for any user, it was connecting and giving access.
I don't know if I am allowed to answer my own question but since I figured it out I am posting it so that it helps someone when they are in need and are on a similar boat.
Sorry and thanks to everyone :)