jas0995
02-22-2006, 04:07 PM
I am trying to create and load some data into a MySQL database from PHP,
but I am having some problems.
<?php
require ('security.php');
//connect to MySQL;
echo "\ntrying to connect to sql server<br>";
$dbh=mysql_connect ("localhost", "ACC_user", "password")
or die ('I cannot connect to the database because:<br> '
. mysql_error() );
echo "<br><br>selecting current database $database<br>";
//make sure our recently created database is the active one
mysql_select_db ( "aczadb" )
or die ('I cannot select the database because:<br> ' .
mysql_error() );
The result I am getting is:
trying to connect to sql server
selecting current database aczadb
I cannot select the database because:
Access denied for user 'ACC_user'@'localhost' to database 'aczadb'
The connect works fine, but then I am rejected in the select.
The ACC_user account has full privs on the database.
This piece of code is basicly right out of a book. It would seem that
it should work, but I don't understand why I am getting this error.
I looked in the error logs for this domain, and do not find any current
errors.
Anyone got any ideas what I am missing?
Thanks!
-jas
but I am having some problems.
<?php
require ('security.php');
//connect to MySQL;
echo "\ntrying to connect to sql server<br>";
$dbh=mysql_connect ("localhost", "ACC_user", "password")
or die ('I cannot connect to the database because:<br> '
. mysql_error() );
echo "<br><br>selecting current database $database<br>";
//make sure our recently created database is the active one
mysql_select_db ( "aczadb" )
or die ('I cannot select the database because:<br> ' .
mysql_error() );
The result I am getting is:
trying to connect to sql server
selecting current database aczadb
I cannot select the database because:
Access denied for user 'ACC_user'@'localhost' to database 'aczadb'
The connect works fine, but then I am rejected in the select.
The ACC_user account has full privs on the database.
This piece of code is basicly right out of a book. It would seem that
it should work, but I don't understand why I am getting this error.
I looked in the error logs for this domain, and do not find any current
errors.
Anyone got any ideas what I am missing?
Thanks!
-jas