#1 (permalink)  
Old 07-31-2009, 03:31 PM
Registered User
 
Join Date: Jul 2009
Posts: 4
Lironcareto is on a distinguished road
MySQL. Access between cPanel accounts.

Hi all
I have two domains in the same hosting services. Each of them has a database named dom1_db and dom2_db respectively, and each of them has a user named dom1_userdb and dom2_userdb. Is there any way for dom1_userdb to login and access to dom2_db? I'd like to share some tables, because replicating information should be a bit dangerous because it exposes to data inconsistencies. It would be a big help to access to the other database.

Thanks in advance!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 08-01-2009, 01:05 AM
Registered User
 
Join Date: Aug 2004
Posts: 472
david510 is on a distinguished road
You can grant access from for the d1 to dbuser2 and vice versa. If you have shell access, you can use the following steps from the mysql prompt.
Code:
grant all privileges on db1.* to dbuser2@localhost identified by 'password';
grant all privileges on d21.* to dbuser1@localhost identified by 'password';
__________________
www.cliffsupport.com
Affordable Server Management Solutions
cPanel server management
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-01-2009, 06:02 AM
Registered User
 
Join Date: Jul 2009
Posts: 4
Lironcareto is on a distinguished road
Thanks, David, but when I try to grant access that way, MySQL returns me the error
Access denied for user 'dbuser2'@'xx.yy.zz.tt' to database 'db2' It's own DB!! And of course I have access with dbuser2 to db2 because it's the main user, the user which I login to DB from MySQL GUI tools with, and the admin user which I login to cPanel for that domain with.

Both databases are in the same server, as I stated before.

It seems that cPanel not only creates users with no access to other databases (which is of common sense) but also with no privilege to grant access to other users, by default. So I was asking for any other way to do that.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-03-2009, 10:41 AM
cPanelDavidG's Avatar
cPanel Technical Sales
 
Join Date: Nov 2006
Location: Houston, TX
Posts: 8,117
cPanelDavidG is on a distinguished road
What I do in this scenario is create another user for my DB in cPanel and grant it all privileges (or whatever privileges are desired) to the database(s) I want that user to have access to.

Then from my other website, I authenticate to MySQL as this user I created. Even though this user was created under another domain, this other website can still authenticate to it since it's on the same server and it is using the MySQL user's authentication credentials.
__________________
Need technical assistance? You can find your best avenue for support at: http://support.cPanel.net
-- cPanel David G., Lead Forum Administrator & cPanel Technical Sales Representative
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 08-03-2009, 03:40 PM
Registered User
 
Join Date: Jul 2009
Posts: 4
Lironcareto is on a distinguished road
Hi DavidG, and thanks for your answer.
Since MySQL users created from cPanel are preceded by the cPanel user (often the domain name) in the way "cpuser_dbuser", any user created for domain1 from domain2 are different.
And if I try to solve this executing the create user command from MySQL Query Browser I get an access denied error.

Could you explain with detail your workaround for this scenario, please?

Thanks in advance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 08-03-2009, 04:22 PM
cPanelDavidG's Avatar
cPanel Technical Sales
 
Join Date: Nov 2006
Location: Houston, TX
Posts: 8,117
cPanelDavidG is on a distinguished road
Quote:
Originally Posted by Lironcareto View Post
Hi DavidG, and thanks for your answer.
Since MySQL users created from cPanel are preceded by the cPanel user (often the domain name) in the way "cpuser_dbuser", any user created for domain1 from domain2 are different.
And if I try to solve this executing the create user command from MySQL Query Browser I get an access denied error.

Could you explain with detail your workaround for this scenario, please?

Thanks in advance.
Sure, I was using the below setup myself up until 9 months ago:

1. Two separate cPanel accounts, let's call them DomainA and DomainB
2. I had a old database used by DomainA, so I had MySQL user under DomainA, let's call it DomainA_dbuser with access to DomainA_db
3. Eventually I created DomainB on the same server, but wanted to access DomainA's databases from DomainB.
4. I just configured my PHP script on DomainB to connect to DomainA_db while authenticating as DomainA_dbuser - connecting to the MySQL server on localhost.
5. Great Success!


Now, if you are using a tool to connect to the database remotely (e.g. MySQL's Query Browser Tool), be sure to add your workstation's IP to the allowed IP list, or else you will get an Access Denied message. You can do this by going to the cPanel interface where the database was created and clicking on the "Remote MySQL" icon. If you don't know your workstation's IP address, you can visit a website like WhatIsMyIPAddress .com
__________________
Need technical assistance? You can find your best avenue for support at: http://support.cPanel.net
-- cPanel David G., Lead Forum Administrator & cPanel Technical Sales Representative
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 08-04-2009, 06:57 PM
Registered User
 
Join Date: Jul 2009
Posts: 4
Lironcareto is on a distinguished road
I understand your solution, David, but I'm afraid it doesn't apply to my case. It wouldn't allow me to join tables between databases in the way select * from db1.table1, db2.table2 where... etc, which is what I really need.

Thanks anyway.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
account , database , mysql

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cpanel MySQL backup blocks dbase access trevHCS cPanel and WHM Discussions 0 01-30-2008 09:03 AM
CPanel-->Mysql --> Access Host NickJ cPanel and WHM Discussions 3 08-14-2005 06:04 AM
MySQL access issues w/new accounts n_kruse cPanel and WHM Discussions 3 10-26-2004 08:06 AM
All Accounts can´t access cPanel cjanjacomo cPanel and WHM Discussions 2 06-09-2004 11:34 PM
Access MySQL DB from outside Cpanel wimp cPanel and WHM Discussions 1 11-29-2002 04:14 AM


All times are GMT -5. The time now is 02:47 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
© cPanel Inc