AGONIZING Mysql Select DB issue.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here's the stats:

Two servers:

Server 1, Mysql 4.0.12, PHP 4.3.2, apache 1.3.27
Server 2, Mysql 4.0.14, PHP 4.3.2, apache 1.3.27

My HTTP is setup on Server 2 (and server 1 as well) I'm setting up a mirror
on Server 2 and it connects to the DB on server 1.

Privs are setup that user has DB access to server 1 from 2 and all that.

I've been working on this for over 2 hours so I am sorry for being very
clear.

My connection string in PHP connects to server 1's DB and then I have a
mysql_select_db() command to select the database. My debugging code shows
that I'm selecting the right DB (let's call it db1) and it returns true as
if it selected fine.

However, whenever I do a query I get an error like "Table 'db2.mytable'
doesn't exist"  (Notice db2 not db1)  (there are like 30 databases on here
I'm just using these two as an example). It's latching onto the wrong
database!

Now I get this error if I enable "Select_Priv" in the User table, if I turn
that off and rely only on the privs in the 'db' table I get "select command
denied to user: 'myuser@xxx.xxx.xxx.xxx' for table 'mytable'"  because it's
attempting to do a select on db2 not 1.  I don't know why.

The ONLY way I  have been able to work around this issue is before I call
the SQL query I have to add db1.mytable to every call to the table. I.e.
Adding "db1" to the beginnign. Then it works around the call to the wrong
database.  This cannot happen all the time. The application is very
extensive and the code is shared between sites so I can't just do this.

Does anyone have any clue why even though I'm calling mysql_select_db("db1")
it still tries to gather data from "db2"?  This only happens when I'm
connecting from Server 2 to server 1 it does not happen any other time.
Incidentally it doesn't happen when I'm connecting from server 2 to another
server running mySQL 3.23.54 there is no problem at all.

I'm thinking it's a permissions system or something funky with MySQL 4 but I
don't know for sure.  Any ideas?

-- 

Thomas Deliduka
IT Manager
     -------------------------
Xenocast
Street Smart Media Solutions
http://www.xenocast.com/



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux