We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Using Dev Tools Locally... VirtualBox host

Setup: OSX, IDE Local WebServer is setup on a VM, CentOS, serving files from host share.

Goal: Be able to run Phalcon DevTools locally, to generate migrations

Problem: Config file sets 'host' => 'localhost' for the database connection (because the database is local to the VM/webserver). Thus, when running any Phalcon DevTools command from the host machine (OS X), which accesses DB (such as it does with migrations), it cannot make the connection to the database (localhost makes no sense from my HOST's terminal).

Is there a way to change the database connection parameters for DevTools only? So that, when telling DevTools to do something database related, it will properly connect to the remote host?

Thanks, Adam



9.3k
Accepted
answer

If you will bind your MySQL instance to your VirtualBox host IP or bind it to listen on all interfaces, you can easily change your config IP address and it will work with your VM and local DevTools. Also you have to allow MySQL user to access via that IP or all IPs and properly configure your firewall if used.

Ah yes. Duh. That makes sense... I was overthinking it. Thank you!