Answers.Body: <p>From Craft Support:
  Assuming the credentials in your .env are correct on that site, could you run ./craft clear-caches/all (or manually empty your web/cpresources and storage/runtime</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-06T13:42:26.910Z
Answers.LastActivityDate: 2020-03-06T13:42:26.910Z
Answers.UserDisplayName: Martin
Answers.Body: <p>Have a look at your .env file on the production system and your config/db.php file your repo. Craft has changed the way db access data is stored and must now be provided as a DSN</p>
  
  <p>This is now config/db.php</p>
  
  <pre><code>return [
      'dsn' =&gt; getenv('DB_DSN'),
      'user' =&gt; getenv('DB_USER'),
      'password' =&gt; getenv('DB_PASSWORD'),
      'schema' =&gt; getenv('DB_SCHEMA'),
      'tablePrefix' =&gt; getenv('DB_TABLE_PREFIX'),
  ];
  </code></pre>
  
  <p>So make sure you have <code>DB_DSN</code> set in your .env file:</p>
  
  <pre><code>DB_DSN="mysql:host=&lt;dbhost&gt;;port=&lt;dbport&gt;;dbname=&lt;db&gt;"
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-06T14:07:11.057Z
Answers.LastActivityDate: 2020-03-06T14:07:11.057Z
Answers.UserDisplayName: Matthias Redl-Mann
Body: <p>For quite a long time i've updated and amended Craft by taking a copy of the files and database (.zip) from the live server, making the updates/changes/amendments locally and then transferring everything back (.zip).</p>
  
  <p>Just recently i've had a couple of instances where i've made amendments and updates to an older site (Craft 3.1x to 3.4x) and everything has been fine locally. I then deploy the updated version back to the live environment and immediately get the error <strong>Craft can’t connect to the database with the credentials in craft/config/db.php</strong>.</p>
  
  <p>I know this is a familiar error for some but i've only recently started seeing it.  I've spent a long time looking for and trying fixes but nothing seems to work for me!?</p>
  
  <p>Mac OS Catalina
  MAMP Pro 5.7
  PHP 7.2.22
  MySQL 5.7.26</p>
  
  <p>Like I say, this is actually quite a new problem for me and I don't know what has changed?  Any help is very much appreciated.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-03T19:59:10.880Z
Comments.Text: Do you have the correct credentials stored in the .env file?
Comments.UserDisplayName: Tim Strawbridge
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-04T11:36:12.537Z
Comments.Text: Hi Tim, yes all correct and checked by a number of different people.  We even have our hosting provider support team looking into it and they can't work it out either.  Also, one of the other businesses in our building has just told me they too are experiencing the same problem!
Comments.UserDisplayName: Martin
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-04T13:23:02.273Z
Comments.Text: Have you tried clearing your caches (`./craft clear-caches/all`) or specifically empty your `storage/runtime` folder? If you move *everything* as you described, some stuff could be cached from your local environment.
Comments.UserDisplayName: Oli
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-04T17:33:38.757Z
Comments.Text: Hi Oli, I cleared caches from the admin (not cli).
Comments.UserDisplayName: Martin
Tags: <database><error-message><deployment><mamp>
Title: Problems transferring updates back to live server
ThreadText: # Problems transferring updates back to live server
  
  (Asked by: username_0 on 2020-03-02)
  
  For quite a long time i've updated and amended Craft by taking a copy of the files and database (.zip) from the live server, making the updates/changes/amendments locally and then transferring everything back (.zip).
  
  Just recently i've had a couple of instances where i've made amendments and updates to an older site (Craft 3.1x to 3.4x) and everything has been fine locally. I then deploy the updated version back to the live environment and immediately get the error **Craft can’t connect to the database with the credentials in craft/config/db.php**.
  
  I know this is a familiar error for some but i've only recently started seeing it. I've spent a long time looking for and trying fixes but nothing seems to work for me!?
  
  Mac OS Catalina
  MAMP Pro 5.7
  PHP 7.2.22
  MySQL 5.7.26
  
  Like I say, this is actually quite a new problem for me and I don't know what has changed? Any help is very much appreciated.
  
  **Tags:** database, error-message, deployment, mamp
  
  > **Comments:**
  > **username_1**: Do you have the correct credentials stored in the .env file?  
  > **username_0**: Hi Tim, yes all correct and checked by a number of different people.  We even have our hosting provider support team looking into it and they can't work it out either.  Also, one of the other businesses in our building has just told me they too are experiencing the same problem!  
  > **username_2**: Have you tried clearing your caches (`./craft clear-caches/all`) or specifically empty your `storage/runtime` folder? If you move *everything* as you described, some stuff could be cached from your local environment.  
  > **username_0**: Hi Oli, I cleared caches from the admin (not cli).  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2020-03-06. Score: 1 | Accepted answer
  
  From Craft Support:
  Assuming the credentials in your .env are correct on that site, could you run ./craft clear-caches/all (or manually empty your web/cpresources and storage/runtime
  
  
  ---
  
  ### Answer by username_3 on 2020-03-06. Score: 1
  
  Have a look at your .env file on the production system and your config/db.php file your repo. Craft has changed the way db access data is stored and must now be provided as a DSN
  
  This is now config/db.php
  
  ```
  return [
      'dsn' => getenv('DB_DSN'),
      'user' => getenv('DB_USER'),
      'password' => getenv('DB_PASSWORD'),
      'schema' => getenv('DB_SCHEMA'),
      'tablePrefix' => getenv('DB_TABLE_PREFIX'),
  ];
  
  ```
  
  So make sure you have `DB_DSN` set in your .env file:
  
  ```
  DB_DSN="mysql:host=<dbhost>;port=<dbport>;dbname=<db>"
  
  ```
  
  
  ---
  
  