By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,836 Members | 2,059 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,836 IT Pros & Developers. It's quick & easy.

Trouble with multiple mysql databases

P: n/a
Hi All,
I'm having trouble accessing multiple databases using a single user.

Basically, I have 2 databases, db1 and db2 and 2 users, user1 and user2.
Originally these were setup so that user1 would only access db1 and user2
would only access db2. However, now I want user1 to access both db1 & db2.

I've used cPanel to declare user1 as a user of db2. However, whenever I try
to access db2 from user1, I get permission problems.

I've tried various combinations of mysql_db_select(), mysql_query("USE
db2Name", $db1link) or just referencing the appropriate table as
'db2Name.tableName' in my SELECT querys but everytime I get a permission
denied response.

Any ideas?. It looks like a cPanel problem to me as it appears that user1 is
simply not being granted access to db2 despite telling cPanel to do so.

Ta in advance,
Dave


Nov 21 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Tue, 21 Nov 2006 19:48:08 -0000, "David" <da**@moorenet.co.ukwrote:
I'm having trouble accessing multiple databases using a single user.

Basically, I have 2 databases, db1 and db2 and 2 users, user1 and user2.
Originally these were setup so that user1 would only access db1 and user2
would only access db2. However, now I want user1 to access both db1 & db2.

I've used cPanel to declare user1 as a user of db2. However, whenever I try
to access db2 from user1, I get permission problems.

I've tried various combinations of mysql_db_select(), mysql_query("USE
db2Name", $db1link) or just referencing the appropriate table as
'db2Name.tableName' in my SELECT querys but everytime I get a permission
denied response.

Any ideas?. It looks like a cPanel problem to me as it appears that user1 is
simply not being granted access to db2 despite telling cPanel to do so.
You may get better answers on the MySQL newsgroup comp.databases.mysql as it
seems to be entirely about MySQL permissions - or some sort of cPanel support
site.

The brute-force method to fix it would probably be something like:

GRANT ALL PRIVILEGES ON db2.* to 'user1@%';

... from a suitably privileged MySQL connection.

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Nov 21 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.