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
https://forums.phpfreaks.com/topic/245042-a-total-noob-here/
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
https://forums.phpfreaks.com/topic/245042-a-total-noob-here/#findComment-1258623
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.