0
<?php
$con = mysql_connect("bangla123.db.8390659.hostedresource.com","bangla123","Algnab123%");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

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

mysql_close($con);
?>

------------
When I run the code, i get error -"Error creating database:....

Pls advise.

Thx.

Edited by Ezzaral: 71 posts and still hasn't learned to use code tags.

4
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by divyakrishnan
0

Please use code tags when you include code.
Don't include your Database id and pw for your own protection.
Some web hosts don't allow you to create databases dynamically. You have to use their control panel / PHPMyAdmin. If that isn't a problem, then double-check that your db info is accurate.

0

Error creating database: Access denied for user 'bangla765'@'%' to database 'hh'

0

This means that your user account does not have the necessary privileges to create a database.Contact the administrator.Try to create the database using phpMyadmin or SQL YOG.

Edited by divyakrishnan: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.