Page 1 of 1

Need Help in Mysql

Posted: Mon Jan 12, 2004 4:13 am
by leacoco
I have a problem in connecting to mysql from php
example:

<?php
$Host = "localhost";
$User ="user";
$Password ="password";
$DBName="NewDB";
$link = mysql_connect($Host,$User,$Password);
if(mysql_create_db($DBName,$link)){
print("DB has been created");
}
else{
print("Not created");
}
mysql_close($link);
?>

And the OUTPUT is

Warning: mysql_connect:Access denied for user 'user@localhost'(using password yes) in c:\createDB.php

Notice: mysql_create_db(): This function is deprecated, Please use mysql_query() to issue a SQL CREATE DATABASE statement instead.

Warning: mysql_create_db(): supplies argument is not a valid mysql-link resource
Database could not be created

Warning: mysql_close() supplied argument is not a valid mysql-link resource.

So i just do not know what to do. I installed mysql and user "User" as the user name and running on the localhost.I changed my Apache to run on localhost:8888. is that a problem?and if not then can someone please Help me out with that.
Thanks in advance.

Posted: Mon Jan 12, 2004 5:32 am
by JayBird
Have you actually set a password for the DB, if not just use

Code: Select all

$Password ="";
mark

Posted: Mon Jan 12, 2004 7:37 am
by leacoco
Yes i have already set the user password during the installatoin process.Or was that wrong?