I want to install an instance of SuiteCRM using a non-standard MySQL socket and port (we have a host serving a number of different databases for different applications/users, so obviously we need to have each database or group of databases running under a separate server process). I overcame a related problem when moving a previously-installed SuiteCRM instance to a new server, by setting db_port in config…php, and at the top of the same file adding the line “ini_set(‘mysqli.default_socket’, …)”, but how do I achieve the same thing on a fresh installation, as there is no option for socket and port in the installation page?
I made a hopeful guess of changing the host to “localhost:3310”, but this had no effect - the installation still fails with a database connection error.
This must surely be a common scenario - any ideas how to proceed?
For reasons beyond my ken, this issue is resolved by specifying the database host in numeric terms, and appending the port number, i.e. instead of “localhost”, putting “127.0.0.1:3310” - this seems to instruct the application to communicate with the database via the port rather than the socket (I had previously tried to effect this by putting “protocol=tcp” in the [client] section of the MySQL configuration, but that made no difference). This simultaneously obviates the need to put an “ini_set(‘mysqli.default_socket’ …)” line in config.php.
Thankyou for that. The above link refers to the “db_socket” configuration option. I cannot find documentation on this, nor is there a default value for it in config.php (have just installed version 7.10.1), so it is not clear whether this change has been implemented - will have to try it out!
Assuming that setting db_socket does work, and that database performance might be an issue with TCP, the implication is therefore that in this situation we should perform a new SuiteCRM installation using 127.0.0.1, because that is the only way to get the installer to recognise a non-standard port, and then after installation we should change the host to “localhost” and specify the db_socket option, so that it reverts to using the socket.
I had the same problem, having 2 DB server running on my machine (mysql & MariaDB).
Considering sock connection is much faster than tcp even if used locally, I made a quick investigation how to use socks.
I found mysqli_connect offer an optional parameter for sock but it can’t be used in any way from core file located in ./include/database/MysqliManager.php
Some other software accept parameter like localhost:/sock/file/location but it doesn’t.
I made a very easy change to core file (I know it shouldn’t be done) but I hope it can be implemented in future release.
Add a parameter to config.php
'db_sock' => '/sock/file/location.sock'
load the optional value in mysqli_connect in ./include/database/MysqliManager.php
I forgot to mention that host must be localhost for using socks.
If host = IP address, tcp connection has precedence (it works with non standard port too) and socks parameter is ignored.
Thank you pgr for suggesting an update on GitHub, done: