-----Original Message-----
Hi All,
After much probing about I've finally got MySQL working and started, but I
can't create a database. I am using:
<?
$conn=mysql_connect("$hostname","$username","$password")
or die("Unable to connect to MySQL"); if($conn){print "Connected
OK<BR>";}
mysql_create_db("counterdb",$conn)
or die("Unable to create database!");
?>
The script connects OK but I am unable to create a database. Is there a
setting that needs to be enabled anywhere to allow a user to do this? I've
tried connecting using both the admin login and the account login, but both
produce an error despite being valid.
-----Original Message-----
#1 - That's bad form. If it did work, and you ran it again, it would try to
create your database, and it would "die".
Try something like;
if ( !mysql_select_db($dbname, $conn) )
{
if ( !mysql_create_db($dname,$conn) )
{
print "Could not create DB\n";
print "Maybe you used a user with incorrect access!!\n";
# some other error handling stuff here
exit;
}
mysql_select_db($dbname, $conn);
}
#2 - What is the $username & $password? Do they have rights to create a
database?
Did you try in the MySQL Command line, using that user name and password?
Your user that runs this script will need to have create/drop priviledges,
check
out the MySQL Documention to see how to do this!
Thanks,
Brian
_______________________________________________
cobalt-developers mailing list
[EMAIL PROTECTED]
http://list.cobalt.com/mailman/listinfo/cobalt-developers