Answers.Body: <p>You can prevent DDEV from writing to your project's .env file by <a href="https://ddev.readthedocs.io/en/stable/users/configuration/config/#disable_settings_management" rel="nofollow noreferrer">disabling settings management</a> in your <code>.ddev/config.yaml</code> file:</p>
  <pre><code>disable_settings_management: true
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-08-30T12:22:40.883Z
Answers.Text: thanks this is it!
  after starting the container now DDEV says:
  
  ```Not creating CMS settings files because disable_settings_management=true```
Answers.UserDisplayName: ludo
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-08-29T12:42:42.967Z
Answers.LastActivityDate: 2024-08-29T12:42:42.967Z
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Body: <p>When DDEV starts, it writes some variables about the db settings in the .env file:</p>
  <pre><code># Database connection settings
  CRAFT_DB_DRIVER=&quot;mysql&quot;
  CRAFT_DB_SERVER=&quot;db&quot;
  CRAFT_DB_PORT=&quot;3306&quot;
  CRAFT_DB_DATABASE=&quot;db&quot;
  CRAFT_DB_USER=&quot;db&quot;
  CRAFT_DB_PASSWORD=&quot;db&quot;
  CRAFT_DB_SCHEMA=
  CRAFT_DB_TABLE_PREFIX=
  </code></pre>
  <p>I have another database (a backup from prod) that I want Craft to use, and obviously when I set this in the env variable, it works. Unfortunately every time DDEV starts it overrides this variable, defaulting to &quot;db&quot;.</p>
  <p>Is there any way to force this variable and disable the override?</p>
  
Tags: <database><craft4><environmentvariables><ddev>
Title: Using a custom CRAFT_DB_DATABASE value at DDEV startup
ThreadText: # Using a custom CRAFT_DB_DATABASE value at DDEV startup
  
  (Asked by: username_0 on 2024-08-29)
  
  When DDEV starts, it writes some variables about the db settings in the .env file:
  
  ```
  # Database connection settings
  CRAFT_DB_DRIVER="mysql"
  CRAFT_DB_SERVER="db"
  CRAFT_DB_PORT="3306"
  CRAFT_DB_DATABASE="db"
  CRAFT_DB_USER="db"
  CRAFT_DB_PASSWORD="db"
  CRAFT_DB_SCHEMA=
  CRAFT_DB_TABLE_PREFIX=
  
  ```
  
  I have another database (a backup from prod) that I want Craft to use, and obviously when I set this in the env variable, it works. Unfortunately every time DDEV starts it overrides this variable, defaulting to "db".
  
  Is there any way to force this variable and disable the override?
  
  **Tags:** database, craft4, environmentvariables, ddev
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-08-29. Score: 1 | Accepted answer
  
  You can prevent DDEV from writing to your project's .env file by [disabling settings management](https://ddev.readthedocs.io/en/stable/users/configuration/config/#disable_settings_management) in your `.ddev/config.yaml` file:
  
  ```
  disable_settings_management: true
  
  ```
  
  > **Comments:**
  > **username_0**: thanks this is it! after starting the container now DDEV says:  ```Not creating CMS settings files because disable_settings_management=true```  
  
  ---
  
  