Page 1 of 1

Can't Select database

Posted: Mon Nov 04, 2002 9:06 pm
by rfigley
Can't seem to select teh database.

Here's the code I'm using. Have done this before without a problem until the phpMyAdmin was upgraded to 2.3.2 with MySQL 3.23.53a . Now when I try creating a new database I can't connect. The existing ones are working fine though. Just the new ones aren't working.

Code: Select all

$db = mysql_connect("localhost","user","password")
or die("Could not open connection to database");
echo "First Line of database connection works  <BR>";

mysql_select_db("database",$db)
or die("Unable to select the database.");


I keep getting:

"First Line of database connection works
Unable to select the database.

Any ideas?

Posted: Tue Nov 05, 2002 2:14 am
by twigletmac
Try using mysql_error() for debugging, it generally gives fairly useful error messages:

Code: Select all

$db = mysql_connect("localhost","user","password") or die(mysql_error()); 

mysql_select_db("database",$db) or die(mysql_error());
Mac

Posted: Tue Nov 05, 2002 7:55 am
by rfigley
OK, it's giving me an "Access Denied" for my user name with this database.
Could it be something with teh permissions. Ive already tried those settings with no results so far

Posted: Tue Nov 05, 2002 8:09 am
by twigletmac
To check out your grants do:

Code: Select all

mysql> SHOW GRANTS FOR your_user@your_host;
from the MySQL command line.

Or in phpMyAdmin just go to the index page then click the users link and then the grants link next to your username. From here you can setup the privileges for that user.

http://www.mysql.com/doc/en/Privileges.html

Mac

Posted: Tue Nov 05, 2002 8:29 am
by rfigley
The grants shown are the same as those for the databases that I CAN access.