Answers.Body: <p>You can set the DSN in the civicrm.settings.php file using this format:</p>
  
  <p><code>mysqli://user:password@unix(/path/to/socket)/databasename</code></p>
  
  <p>Use the actual word "unix" in the string to indicate sockets.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-11T02:19:16.267Z
Answers.Text: for sure your guidance help, however, as StackExchange members are picky, it could not being accepted as the right answer because you forget to mention the password such as: `mysql://user:password@unix(/path/to/socket)/databasename`.
Answers.UserDisplayName: user7251
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-11T03:57:03.070Z
Answers.Text: You're right I've updated the answer. Thanks.
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-23T09:41:07.290Z
Answers.Text: cv, the command line of CiviCRM don't like it
Answers.UserDisplayName: user7251
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-23T12:35:18.257Z
Answers.Text: Can you post that as a separate question, and include the error message.
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-10T13:51:17.403Z
Answers.LastActivityDate: 2019-07-11T03:56:42.940Z
Answers.LastEditDate: 2019-07-11T03:56:42.940Z
Answers.UserDisplayName: Demerit
Answers.Body: <p>I believe CiviCRM does support UNIX sockets, yes. If your hostname is "localhost" and there's no port configured, MySQL defaults to a UNIX socket connection.</p>
  
  <pre><code>$ grep DSN sites/default/civicrm.settings.php
    define('CIVICRM_UF_DSN', 'mysql://vagrant:vagrant@localhost/vagrant?new_link=true');
    define('CIVICRM_DSN', 'mysql://vagrant:vagrant@localhost/vagrant?new_link=true');
  </code></pre>
  
  <p>And for me, <code>cv</code> works fine with this configuration:</p>
  
  <pre><code>$ cv api3 Contact.get
  {
      "is_error": 0,
      "version": 3,
      "count": 25,
      "values": {
          "202": {
              "contact_id": "202",
              "contact_type": "Individual",
  </code></pre>
  
  <p>I did notice on a recent (Drupal, web UI) installation that CiviCRM defaulted to adding <code>:3306</code> into the <code>CIVICRM_DSN</code> value (but not the <code>CIVICRM_UF_DSN</code> setting). IDK why this happened, but this might be the source of your issue?</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-06T00:48:39.573Z
Answers.LastActivityDate: 2019-08-06T00:48:39.573Z
Answers.UserDisplayName: Chris Burgess
Body: <p>My wordpress is installed and uses localhost:/run/mysqld/mysqld/socket
  but civicrm only works if I point to localhost</p>
  
  <p>Is there a way to install civicrm through file socket ?</p>
  
Tags: <mysql>
Title: Does civicrm support mysql sockets?
ThreadText: # Does civicrm support mysql sockets?
  
  (Asked by: username_0 on 2019-07-10)
  
  My wordpress is installed and uses localhost:/run/mysqld/mysqld/socket
  but civicrm only works if I point to localhost
  
  Is there a way to install civicrm through file socket ?
  
  **Tags:** mysql
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-07-10. Score: 2 | Accepted answer
  
  You can set the DSN in the civicrm.settings.php file using this format:
  
  `mysqli://user:password@unix(/path/to/socket)/databasename`
  
  Use the actual word "unix" in the string to indicate sockets.
  
  > **Comments:**
  > **username_0**: for sure your guidance help, however, as StackExchange members are picky, it could not being accepted as the right answer because you forget to mention the password such as: `mysql://user:password@unix(/path/to/socket)/databasename`.  
  > **username_1**: You're right I've updated the answer. Thanks.  
  > **username_0**: cv, the command line of CiviCRM don't like it  
  > **username_1**: Can you post that as a separate question, and include the error message.  
  
  ---
  
  ### Answer by username_2 on 2019-08-06. Score: 2
  
  I believe CiviCRM does support UNIX sockets, yes. If your hostname is "localhost" and there's no port configured, MySQL defaults to a UNIX socket connection.
  $ grep DSN sites/default/civicrm.settings.php
    define('CIVICRM_UF_DSN', 'mysql://vagrant:vagrant@localhost/vagrant?new_link=true');
    define('CIVICRM_DSN', 'mysql://vagrant:vagrant@localhost/vagrant?new_link=true');
  
  And for me, cv works fine with this configuration:
  $ cv api3 Contact.get
  {
      "is_error": 0,
      "version": 3,
      "count": 25,
      "values": {
          "202": {
              "contact_id": "202",
              "contact_type": "Individual",
  
  I did notice on a recent (Drupal, web UI) installation that CiviCRM defaulted to adding :3306 into the CIVICRM_DSN value (but not the CIVICRM_UF_DSN setting). IDK why this happened, but this might be the source of your issue?
  
  
  ---
  
  