开发者

can cakePHP connect to remote database?

I am setting up CakePHP for the first time in order to develop the server side o开发者_Python百科f the website I'm building. I already have a database set up on a remote server. So I want CakePHP to connect to that server. That's not working. I get a notice "Cake is NOT able to connect to the database."

I've tried changing the settings in cake\app\database.php:

persistent: true or false

host: with or without prefix 'http://'

But none of that helps. All the examples I've seen have server set to 'localhost'.

Can anyone tell me if cakePHP can connect to a remote db? Or am I completely missing the point and should I be using the mysql server included in my WAMP set?


You have 2 options

Option 1

Your webhost needs to allow connections to the mysql instance from outside the local network.

Check the manuals for the webhost if you're allowed to change the mysql configuration yourself you may be allowed to accept incoming connections.

Your method only works when the host accepts incoming connections on for example port 3306 which is the default mysql port.

Option 2

If you have SSH access to the remote host, you're able to set up a tunnel. Which would make you connect to the Mysql Instance though your SSH connection on a local port.

One way you could do this is by using PuTTY.

How to set up a MySQL tunnel in PuTTY

can cakePHP connect to remote database?

can cakePHP connect to remote database?

can cakePHP connect to remote database?

Initiate the connection and keep it alive.

Use the host 127.0.0.1 and port 3306 in your CakePHP Database config.

Username & Password would be your MySQL User Credentials

can cakePHP connect to remote database?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜