PHP MySQL authentication error -


i have created html form (demo.html) & post it's value php file (demo1.php). created database in mysql & wrote connection code in php file (demo1.php) gives following error

warning: mysql_connect() [function.mysql-connect]: access denied user 'root'@'localhost' (using password: yes) in c:\xampp\htdocs\demo1.php on line 8 error connecting mysql

<?php // contact database $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'password';  $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('error connecting mysql'); //$conn = mysql_connect("localhost","root","password") or die ('error connecting mysql');  $dbname = 'test'; mysql_select_db($dbname,$conn);  //$connect = mysql_connect("localhost", "root", "pass") or die ("error , check server connection.");  //mysql_select_db("test");    //get data in local variable  $v_name=$_post['name'];  $v_email=$_post['email'];  $v_msg=$_post['msg'];    // check null values  if ($v_name==""  or $v_msg=="")  echo "all fields must entered, hit button , re-enter information";  else{  $query="insert contact(name,email,msg) values('$v_name','$v_email','$v_msg')";  mysql_query($query)  or die(mysql_error());  echo "your message has been received";  mysql_close($conn);  }  ?> 

password user root incorrect.

default password on local (home) server empty, think can help:

$dbpass = ''; 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -