We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21257 MODX Staff
    • 730 Posts
    If you need to specify a MySQL server via it’s socket, and it’s not on the default socket, here’s how you do it when installing MODx, or editing your manager/includes/config.inc.php file. The "host" variable ($database_server in the config file), which is typically set to "localhost" or even "localhost:port" can also take the path to your socket file:
    :/path/to/nonstandard/mysql.sock
    

    It is mandatory to specify the full colon at the beginning of the path. This is what tripped me up in the past and I only realized this when tracing through the DBAPI code and reading the PHP manual today.
    Hope this helps someone.

    p.s. Unless I’m crazy, connecting via an explicit socket feels like it gives a site a performance boost too - the incremental performance improvement of socket connections must multiply themselves over the course of all the database activity that MODx incurs on a single page request.
      Mike Schell
      Lead Developer, MODX Cloud
      Email: [email protected]
      GitHub: https://github.com/netProphET/
      Twitter: @mkschell
      • 6939
      • 4 Posts
      I am an oldschool programmer, and this is something that I have had trouble with, becuase I expect pure logic when programming

      When, during install one is prompted for "Host" for the sql database, I really, truly fundamentally believe the label should read "Host:Port"

      becuase a host is a host and a port is a port, and I have had to learn not to induce extra information to become a good programmer, not "follow the obvious"

      Cheers for the fabulous infrastructure.

      Chris