Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 6112

Access denied for user 'root'@'localhost' (using password: NO)?Unable to authenticate php/Mysql? [duplicate]

$
0
0

I am getting following error:

"Access denied for user 'root'@'localhost' (using password: NO)?" Unable to authenticate php/Mysql

I am getting this error using lamp server on ubuntu.

<?php    $not_login = 0;    if ($_SERVER["REQUEST_METHOD"] == "POST")    {        $servername = "localhost";        $username = "root";        $password = "";        $con = mysql_connect($servername,$username);        if ($con) {            $db = mysql_select_db("ccmsdb",$con);        }        else{die(mysql_error());    }    $login = "LOGIN";    $userid=$_POST['userid'];    $password = $_POST['password'];    //$password = md5($password);    if ($db) {        $query = "SELECT * FROM client WHERE   `userid`='$userid' AND `password`='$password'";        $result = mysql_query($query);        $rows_count = mysql_num_rows($result);        if ($rows_count>0) {            header("Location:../welcome.php");        }        else        {            $not_login=1;        }        if(!empty($data))        {        }    }}?><html><form action="" method="post"><h1>Log-In</h1><p>   <label for="Userid">User Id:</label><input type="text" name="userid"></p><p><label for="Password">Password:</label><input type="Password" name="password"></p><button>Login</button></form>


Viewing all articles
Browse latest Browse all 6112

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>