Fruct0se Posted September 2, 2009 Share Posted September 2, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/172767-solved-dedicated-server-two-sites-same-db/ Share on other sites More sharing options...
corbin Posted September 2, 2009 Share Posted September 2, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/172767-solved-dedicated-server-two-sites-same-db/#findComment-910676 Share on other sites More sharing options...
Fruct0se Posted September 2, 2009 Author Share Posted September 2, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/172767-solved-dedicated-server-two-sites-same-db/#findComment-910688 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.