Powered by Invision Power Board



  Reply to this topicStart new topicStart Poll

> Connect to another Database on the other host
cakephp
Posted: Aug 17 2011, 05:03 AM
Quote Post


Newbie
*

Group: Members
Posts: 2
Member No.: 3105
Joined: 17-August 11



I have a program with cake php, in one host and I have another Database on the another host .
At first I want connect to Database on the other host after that insert my information on that Database, I really try alot but I don't success.
Can you help me? sad.gif
PMEmail Poster
Top
Red7
Posted: May 3 2012, 05:04 PM
Quote Post


Member
**

Group: Members
Posts: 13
Member No.: 3415
Joined: 4-April 12



This is one of those questions where if you have to ask, you're going to run into a heap of trouble. I'll do my best to help you but you could quickly find yourself in over your head so tread carefully and never make any of these changes unless you have a backup. Ok? I do not guarantee any security for your website using this method.

In config/database.php find where it asks for

'host' => 'localhost'

Change localhost to the full domain name or external IP of your remote database.

Yo;l need to change the rest of those fields to match the username, database name and password of the remote database. That'll get Cakephp to request a connection to a remote database.

Only, there's 1 catch. You now have to configure your remote database to accept that connection. By default, a MySQL database will only accept connections from the localhost. You can change that, but it depends on 100,000 other factors and variables. This is where I'm worried that you may be in over your head so be careful. 1 mistake here and you could end up giving everyone free access to your entire database.

You'll have to search for how to do this using whatever tools you have at your disposal. PHPMyAdmin or Workbench, SSH, CPanel, etc.. It's a different process for each. Good luck!
PMEmail Poster
Top
noahwilson
Posted: Mar 30 2013, 10:53 AM
Quote Post


Advanced Member
***

Group: Members
Posts: 79
Member No.: 3816
Joined: 30-March 13



please share some other information, i am not fully understand you problem. so please tell which code show the problem.
Thanks


--------------------
PMEmail PosterUsers Website
Top
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll

 

Disclaimer:
This forum is in no way affiliated with the Cake Software Foundation
The CakePHP name and icon is a trademark of the Cake Software Foundation


Lo-Fi Version