Jump to content

[SOLVED] Dedicated Server, Two Sites, Same DB?


Fruct0se

Recommended Posts

I have a dedicated server which I can access through PLESK... I have two seperate sites, one is a .com and the other a .mobi for cell phone users. Is there a way that both sites can access the same db? The main DB is on the .com but it appears that each site is given its own seperate db's

 

I thought using just localhost since it was on the same machine it would work but it does not, any ideas would be great.

Link to comment
Share on other sites

If the sites are in their own VPS's or listening on different network adapters than localhost for 1 site is not the same localhost for the other site.  If that's the case, try using the LAN IP.

 

 

Otherwise, it should be a simple matter of using the username/password from the first site.

 

Link to comment
Share on other sites

Ok I figured it out:

 

I had to log into ssh bash and go to the mysql terminal. Then I had to add privileges to the user trying to access the database from a different domain. For anyone that is interested these are the commands used:

 

CREATE USER 'username'@'IP' IDENTIFIED BY 'username';

GRANT SELECT ,
INSERT ,

UPDATE ,
DELETE ,
CREATE ,
DROP ,
FILE ,
INDEX ,
ALTER ,
EXECUTE ON * . * TO 'username'@'IP' IDENTIFIED BY 'password' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;

GRANT ALL PRIVILEGES ON `database` . * TO 'username'@'IP';

 

The above will create a user, give permissions on that IP to access the DB as well as permissions to modify it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.