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.
Need Help in Mysql
Moderator: General Moderators
Have you actually set a password for the DB, if not just use
mark
Code: Select all
$Password ="";