Jump to content

A total noob here !


aboutera

Recommended Posts

This is a code to create a database

<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

if (mysql_query("CREATE DATABASE my_db",$con))
  {
  echo "Database created";
  }
else
  {
  echo "Error creating database: " . mysql_error();
  }

mysql_close($con);
?>

 

and that is the error I am getting : Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'peter'@'localhost' (using password: YES) in C:\wamp\www\New folder\iji.php on line 2

Could not connect: Access denied for user 'peter'@'localhost' (using password: YES)

Please help

Link to comment
Share on other sites

sounds like your mysql_connect credentials are incorrect..

double check the credentials and keep character casing in mind..

 

could you explain more please ? how to check these credentials?

thank you

 

$con = mysql_connect("localhost","peter","abc123");

 

You need to make sure you change 'peter' to your username and 'abc123' to your password you have set for mysql.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.