Answers.Body: <p>Spent a few hours trying to solve this problem and found the solution to my problem was to add 3306 to the server address. It does say if your server is not using the standard port them to indicated the port. I'm guessing it was trying to use sockets to connect but by using the port address it knows which one to use.</p>
  
  <p>I also found that installing from a zip file worked better than trying a manual install. The only problem was my Php had a file size limit which needed to be increased but apache kept reporting the upload was to big. In the end used a plug in to upload larger files for wordpress <a href="https://wordpress.org/plugins/upload-larger-plugins/" rel="nofollow noreferrer">upload larger plugins</a>. Now just have a problem with the crm not seeing curl. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-10T17:05:23.763Z
Answers.Text: Hi Barry, you've posted this as an answer, but I'm not sure if you are looking for help yourself.  If you that's the case, you should ask this as a new question.
Answers.UserDisplayName: William Mortada
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-10T07:37:41.810Z
Answers.LastActivityDate: 2017-07-10T07:37:41.810Z
Answers.UserDisplayName: Barry O'shaughnessy
Answers.Body: <p>It sounds like you've got something unusual in your <code>civicrm.settings.php</code> file.  Here's what the relevant lines look like for me:</p>
  
  <pre><code>define( 'CIVICRM_UF_DSN'           , 'mysql://nwu:&lt;password&gt;@localhost/nwu_wp?new_link=true' );
  define( 'CIVICRM_DSN'          , 'mysql://nwu:&lt;password&gt;@localhost/nwu_wpcivicrm?new_link=true' );
  </code></pre>
  
  <p>Please check the corresponding lines in your installation.  If you're not sure how to fix it, please update your question to include those lines - make sure to redact your password!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-15T00:09:43.080Z
Answers.Text: Bless you for your response! Unfortunately, everything looks standard in the settings files that CiviCRM generates. I've added additional info about this to the question above. Thanks for any ideas you have.
Answers.UserDisplayName: K Schoonmaker
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-15T00:31:21.523Z
Answers.Text: Oh sweet Jesus. I took another look at your note and saw that the database information is actually defined in two locations... that are really close to each other in the settings files. >__< I only added tcp:() to one of these strings. Adding this in in the other location means that at least one of my 4.6 installs is working now. Still not sure why the 4.7.17 version can't see my MySQL server at "localhost:/tmp/mysql.sock"... and why the 4.7.17 upgrade script returns the white screen of death in my current database... but for now, I'll take it!
Answers.UserDisplayName: K Schoonmaker
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-26T04:21:27.780Z
Answers.Text: You mentioned that you're running on port 3306 - but everything else says you're using a socket file.  Which is it?  If you're running on port 3306, what about just using that instead of the socket file?
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-28T20:47:44.717Z
Answers.Text: Hi, in the server description I see in phpMyAdmin, it says "Server: Localhost via UNIX socket." But it also says "Server: localhost:3306" at the top of the screen. My server admins say that I should use the socket location for installations like WP, but also say that the server is running on the standard port, 3306. So, I'm not sure. None of the options --localhost, localhost:3306 or localhost:/tmp/mysql.sock-- make a difference to the 4.7.17 CiviCRM installer, which can't locate the database using any of them.
Answers.UserDisplayName: K Schoonmaker
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-12T14:26:02.360Z
Answers.LastActivityDate: 2017-04-12T14:26:02.360Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>I've been trying to install CiviCRM on fresh WordPress 4.7.3 installations on my managed server, but I keep having database connection problems. </p>
  
  <p>When I try to install CiviCRM 4.7.17, the CiviCRM installer can't locate the database or validate any of the database details.</p>
  
  <p>The MySQL server "Does the server exist?" line returns this message:
  *Can't find the a MySQL server on 'localhost:/tmp/mysql.sock'.: Unknown MySQL server host 'localhost:/tmp/mysql.sock' (2)**</p>
  
  <p>I am using exactly the same database information --MySQL server at localhost:/tmp/mysql.sock/-- that I used to successfully install WordPress. </p>
  
  <p>I've also tried installing CiviCRM 4.6.0 and 4.6.26 on separate fresh installations of WordPress 4.7.3. In both of these attempts, the CiviCRM installer locates the database just fine (using localhost:/tmp/mysql.sock as the MySQL server), and says that the installation has completed successfully after I click "Install." </p>
  
  <p>However, when I click on the CiviCRM tab in both instances, this error appears, and CiviCRM fails to open:</p>
  
  <p>Array
  (
      [callback] => Array
          (
              [0] => CRM_Core_Error
              [1] => simpleHandler
          )</p>
  
  <pre><code>[code] =&gt; -24
  [message] =&gt; DB Error: connect failed
  [mode] =&gt; 16
  [debug_info] =&gt;  [nativecode=Can't connect to local MySQL server through socket '/set-in-php.ini' (2)]
  [type] =&gt; DB_Error
  [user_info] =&gt;  [nativecode=Can't connect to local MySQL server through socket '/set-in-php.ini' (2)]
  [to_string] =&gt; [db_error: message="DB Error: connect failed" code=-24 mode=callback callback=CRM_Core_Error::simpleHandler prefix="" info=" [nativecode=Can't connect to local MySQL server through socket '/set-in-php.ini' (2)]"]
  </code></pre>
  
  <p>)</p>
  
  <p>I've contacted my managed server's administrators about this, but they think this is CiviCRM-specific problem and haven't been able to help. </p>
  
  <p>We're using PHP 5.6.30. Our other server information is as follows:</p>
  
  <p>Server: Localhost via UNIX socket
  Server type: MySQL
  Server version: 5.5.27 - MySQL Community Server (GPL)
  Protocol version: 10
  User: root@localhost</p>
  
  <p>Apache/2.2.32 (Unix) mod_ssl/2.2.32 OpenSSL/1.0.1e-fips PHP/5.6.30 mod_pubcookie/3.3.4a mod_uwa/3.2.1
  Database client version: libmysql - 5.5.18
  PHP extension: mysqli</p>
  
  <p>This PHP warning pops up in our error logs every time I try to access a CiviCRM installation unsuccessfully:</p>
  
  <p>PHP Warning:  mysqli_real_escape_string() expects parameter 1 to be mysqli, boolean given in /data/www/<strong>_our____website_</strong>/wp-content/plugins/civicrm/civicrm/install/index.php on line 1256</p>
  
  <p>Line 1256 in index.php is: global $installDirPath;</p>
  
  <p>I'm not sure what's causing this problem, and I appreciate any insights you might have.</p>
  
  <hr>
  
  <p>Per Jon G's note below: the civicrm.settings.php files that are generated in the installation appear to be standard.</p>
  
  <p>The default settings files that are generated return the following database lines:</p>
  
  <p>if (!defined('CIVICRM_UF_DSN')) {
  define( 'CIVICRM_UF_DSN'           , 'mysql://username:password@localhost:/tmp/mysql.sock/civicrm-again?new_link=true');
  }</p>
  
  <p>...which look standard. In the past, I've had to manually edit these lines to accommodate the non-standard localhost location (localhost:/tmp/mysql.sock) by inserting tcp( ), like this:</p>
  
  <p>if (!defined('CIVICRM_UF_DSN')) {
  define( 'CIVICRM_UF_DSN'           , 'mysql://username:password@<strong>tcp(**localhost:/tmp/mysql.sock</strong>)**/civicrm-again?new_link=true');
  }</p>
  
  <p>After that --in the past-- CiviCRM worked fine.</p>
  
  <p>Now, neither the default version nor the adjusted tcp() one allows CiviCRM to initialize in my successful 4.6 installations. (I've also tried inputting just "localhost" in place of "localhost:/tmp/mysql.sock" here, but that returns the same error.)</p>
  
  <p>Finally, the MySQL server is running on the standard port, 3306.</p>
  
  <hr>
  
  <p>Also, I should mention two other things: I installed CiviCRM in 4.6.0 on our server successfully in the past, and this version was working fine till I tried to upgrade to 4.7.17. Since running the upgrade script, clicking on the CiviCRM tab returns an HTTP error 500.</p>
  
  <p>Also, for this and the other 4.6 installations, I adjusted a line in the installation code in modules/civicrm/install/civicrm.php, adding an additional tcp(...) around the server location, per this thread: <a href="https://forum.civicrm.org/index.php?topic=12500.0;prev_next=prev#new" rel="nofollow noreferrer">https://forum.civicrm.org/index.php?topic=12500.0;prev_next=prev#new</a></p>
  
  <p>The revised line looks like this:
  $dsn = "mysql://{$config['mysql']['username']}:{$config['mysql']['password']}@tcp({$config['mysql']['server']})/{$config['mysql']['database']}?new_link=true";</p>
  
  <hr>
  
  <p><strong>UPDATE:</strong> I'm still not able to install CiviCRM 4.7.18, but I was able to upgrade my previous database to 4.7.22 by adjusting the civicrm.settings.php file. 
  I got it to work by adding @tcp( ) to civicrm.settings.php (as mentioned above), changing "localhost" to 127.0.0.1, and specifying the port as :3306. The lines I changed were:</p>
  
  <p>define( 'CIVICRM_UF_DSN'; 'mysql://user:password@tcp(127.0.0.1:3306)/database?new_link=true');
  define('CIVICRM_DSN', 'mysql://user:password@tcp(127.0.0.1:3306)/database?new_link=true');
  define('CIVICRM_DB_CACHE_HOST', '127.0.0.1');
  define('CIVICRM_DB_CACHE_PORT', 3306 );</p>
  
  <p>After running the upgrade script again, the upgrade worked!</p>
  
Tags: <wordpress><database><mysql>
Title: CiviCRM Can't Connect to Databases on Server, but WordPress Can
ThreadText: # CiviCRM Can't Connect to Databases on Server, but WordPress Can
  
  (Asked by: username_0 on 2017-04-07)
  
  I've been trying to install CiviCRM on fresh WordPress 4.7.3 installations on my managed server, but I keep having database connection problems. 
  When I try to install CiviCRM 4.7.17, the CiviCRM installer can't locate the database or validate any of the database details.
  The MySQL server "Does the server exist?" line returns this message:
  *Can't find the a MySQL server on 'localhost:/tmp/mysql.sock'.: Unknown MySQL server host 'localhost:/tmp/mysql.sock' (2)**
  I am using exactly the same database information --MySQL server at localhost:/tmp/mysql.sock/-- that I used to successfully install WordPress. 
  I've also tried installing CiviCRM 4.6.0 and 4.6.26 on separate fresh installations of WordPress 4.7.3. In both of these attempts, the CiviCRM installer locates the database just fine (using localhost:/tmp/mysql.sock as the MySQL server), and says that the installation has completed successfully after I click "Install." 
  However, when I click on the CiviCRM tab in both instances, this error appears, and CiviCRM fails to open:
  Array
  (
      [callback] => Array
          (
              [0] => CRM_Core_Error
              [1] => simpleHandler
          )
  [code] => -24
  [message] => DB Error: connect failed
  [mode] => 16
  [debug_info] =>  [nativecode=Can't connect to local MySQL server through socket '/set-in-php.ini' (2)]
  [type] => DB_Error
  [user_info] =>  [nativecode=Can't connect to local MySQL server through socket '/set-in-php.ini' (2)]
  [to_string] => [db_error: message="DB Error: connect failed" code=-24 mode=callback callback=CRM_Core_Error::simpleHandler prefix="" info=" [nativecode=Can't connect to local MySQL server through socket '/set-in-php.ini' (2)]"]
  
  )
  I've contacted my managed server's administrators about this, but they think this is CiviCRM-specific problem and haven't been able to help. 
  We're using PHP 5.6.30. Our other server information is as follows:
  Server: Localhost via UNIX socket
  Server type: MySQL
  Server version: 5.5.27 - MySQL Community Server (GPL)
  Protocol version: 10
  User: root@localhost
  Apache/2.2.32 (Unix) mod_ssl/2.2.32 OpenSSL/1.0.1e-fips PHP/5.6.30 mod_pubcookie/3.3.4a mod_uwa/3.2.1
  Database client version: libmysql - 5.5.18
  PHP extension: mysqli
  This PHP warning pops up in our error logs every time I try to access a CiviCRM installation unsuccessfully:
  PHP Warning:  mysqli_real_escape_string() expects parameter 1 to be mysqli, boolean given in /data/www/_our____website_/wp-content/plugins/civicrm/civicrm/install/index.php on line 1256
  Line 1256 in index.php is: global $installDirPath;
  I'm not sure what's causing this problem, and I appreciate any insights you might have.
  
  Per Jon G's note below: the civicrm.settings.php files that are generated in the installation appear to be standard.
  The default settings files that are generated return the following database lines:
  if (!defined('CIVICRM_UF_DSN')) {
  define( 'CIVICRM_UF_DSN'           , 'mysql://username:password@localhost:/tmp/mysql.sock/civicrm-again?new_link=true');
  }
  ...which look standard. In the past, I've had to manually edit these lines to accommodate the non-standard localhost location (localhost:/tmp/mysql.sock) by inserting tcp( ), like this:
  if (!defined('CIVICRM_UF_DSN')) {
  define( 'CIVICRM_UF_DSN'           , 'mysql://username:password@tcp(**localhost:/tmp/mysql.sock)**/civicrm-again?new_link=true');
  }
  After that --in the past-- CiviCRM worked fine.
  Now, neither the default version nor the adjusted tcp() one allows CiviCRM to initialize in my successful 4.6 installations. (I've also tried inputting just "localhost" in place of "localhost:/tmp/mysql.sock" here, but that returns the same error.)
  Finally, the MySQL server is running on the standard port, 3306.
  
  Also, I should mention two other things: I installed CiviCRM in 4.6.0 on our server successfully in the past, and this version was working fine till I tried to upgrade to 4.7.17. Since running the upgrade script, clicking on the CiviCRM tab returns an HTTP error 500.
  Also, for this and the other 4.6 installations, I adjusted a line in the installation code in modules/civicrm/install/civicrm.php, adding an additional tcp(...) around the server location, per this thread: https://forum.civicrm.org/index.php?topic=12500.0;prev_next=prev#new
  The revised line looks like this:
  $dsn = "mysql://{$config['mysql']['username']}:{$config['mysql']['password']}@tcp({$config['mysql']['server']})/{$config['mysql']['database']}?new_link=true";
  
  UPDATE: I'm still not able to install CiviCRM 4.7.18, but I was able to upgrade my previous database to 4.7.22 by adjusting the civicrm.settings.php file. 
  I got it to work by adding @tcp( ) to civicrm.settings.php (as mentioned above), changing "localhost" to 127.0.0.1, and specifying the port as :3306. The lines I changed were:
  define( 'CIVICRM_UF_DSN'; 'mysql://user:password@tcp(127.0.0.1:3306)/database?new_link=true');
  define('CIVICRM_DSN', 'mysql://user:password@tcp(127.0.0.1:3306)/database?new_link=true');
  define('CIVICRM_DB_CACHE_HOST', '127.0.0.1');
  define('CIVICRM_DB_CACHE_PORT', 3306 );
  After running the upgrade script again, the upgrade worked!
  
  **Tags:** wordpress, database, mysql
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2017-07-10. Score: 2
  
  Spent a few hours trying to solve this problem and found the solution to my problem was to add 3306 to the server address. It does say if your server is not using the standard port them to indicated the port. I'm guessing it was trying to use sockets to connect but by using the port address it knows which one to use.
  
  I also found that installing from a zip file worked better than trying a manual install. The only problem was my Php had a file size limit which needed to be increased but apache kept reporting the upload was to big. In the end used a plug in to upload larger files for wordpress [upload larger plugins](https://wordpress.org/plugins/upload-larger-plugins/). Now just have a problem with the crm not seeing curl.
  
  > **Comments:**
  > **username_2**: Hi Barry, you've posted this as an answer, but I'm not sure if you are looking for help yourself.  If you that's the case, you should ask this as a new question.  
  
  ---
  
  ### Answer by username_3 on 2017-04-12. Score: 1
  
  It sounds like you've got something unusual in your civicrm.settings.php file.  Here's what the relevant lines look like for me:
  define( 'CIVICRM_UF_DSN'           , 'mysql://nwu:@localhost/nwu_wp?new_link=true' );
  define( 'CIVICRM_DSN'          , 'mysql://nwu:@localhost/nwu_wpcivicrm?new_link=true' );
  
  Please check the corresponding lines in your installation.  If you're not sure how to fix it, please update your question to include those lines - make sure to redact your password!
  
  > **Comments:**
  > **username_0**: Bless you for your response! Unfortunately, everything looks standard in the settings files that CiviCRM generates. I've added additional info about this to the question above. Thanks for any ideas you have.  
  > **username_0**: Oh sweet Jesus. I took another look at your note and saw that the database information is actually defined in two locations... that are really close to each other in the settings files. >__< I only added tcp:() to one of these strings. Adding this in in the other location means that at least one of my 4.6 installs is working now. Still not sure why the 4.7.17 version can't see my MySQL server at "localhost:/tmp/mysql.sock"... and why the 4.7.17 upgrade script returns the white screen of death in my current database... but for now, I'll take it!  
  > **username_3**: You mentioned that you're running on port 3306 - but everything else says you're using a socket file.  Which is it?  If you're running on port 3306, what about just using that instead of the socket file?  
  > **username_0**: Hi, in the server description I see in phpMyAdmin, it says "Server: Localhost via UNIX socket." But it also says "Server: localhost:3306" at the top of the screen. My server admins say that I should use the socket location for installations like WP, but also say that the server is running on the standard port, 3306. So, I'm not sure. None of the options --localhost, localhost:3306 or localhost:/tmp/mysql.sock-- make a difference to the 4.7.17 CiviCRM installer, which can't locate the database using any of them.  
  
  ---
  
  