MySQL Forums
Forum List  »  Newbie

Access denied for user 'ODBC'@'localhost' (using password: NO)
Posted by: Cristian George
Date: July 09, 2005 12:49AM

Hello,

I cannot select the database that I succesfully created with Mysql 4.1 and I keep getting the below warnings:

Connected successfully
Warning: mysql_select_db(): Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\Program Files\Apache Group\Apache2\htdocs\tracking\connect.php on line 9

Warning: mysql_select_db(): A link to the server could not be established in C:\Program Files\Apache Group\Apache2\htdocs\tracking\connect.php on line 9
Invalid database

Can anybody explainn me why I can select the database using "mysql.exe" while this is not possible through the following simple script:
<?
$link = mysql_connect("localhost", "root", "alfa");
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
mysql_select_db("admin") or die ("Invalid database");
?>

Here the relevant "create" script:

// ne conectam la baza de date
$link = mysql_connect("localhost", "root", "alfa") or die("could not connect.");
print "connected successfully.";

// cream baza de date 'admin'
$sql = "create database admin";
query_exec($sql);
mysql_select_db("admin") or die("<br>could not select database admin.");
print "<br>database selected successfully.";

// admin
$sql = "create table admin (

admin_user text not null,
admin_pass text not null
)";
query_exec($sql);

//
$sql = "insert into admin values('admin', md5('admin'))";
query_exec($sql);

Options: ReplyQuote


Subject
Written By
Posted
Access denied for user 'ODBC'@'localhost' (using password: NO)
July 09, 2005 12:49AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.