<p>Does the table prefix value in you <code>.env</code> file need to be in quotes? eg</p>
<pre><code>DB_TABLE_PREFIX=&quot;craft&quot;
</code></pre>

CC BY-SA 4.0
2020-09-15T06:43:18.013Z
However - this sounds to me more like an issue with the credentials. Generally if the table prefix value is wrong Craft will just think it is not installed and try a new installation …
Cole Henley
CC BY-SA 4.0
2020-09-15T15:16:40.650Z
Thanks for the response. As noted above, the table prefix between Craft 2 and 3 is the same. The prefix wrapped in quotes wasn't the solution.
Shad
CC BY-SA 4.0
2020-09-16T16:05:08.093Z
In Craft 3 I think you need to add the underscore for the prefix value so Craft 2 is `craft` but for Craft 3 would be `craft_`
Cole Henley
CC BY-SA 4.0
2020-09-16T19:15:26.897Z
Tried that yesterday, but still no luck. Thanks for checking back in though!
Shad
CC BY-SA 4.0
2021-02-12T08:30:55.753Z
When the error message reads "can't connect to the database with the credentials" then you have a permissions error. Its not even reaching the db server thus it cannot be a problem with the table prefixes.

In a .env file, you do not need to use quotes unless there are spaces or other "special chars" in your term.
MisterMike
CC BY-SA 4.0
2020-09-15T06:42:30.107Z
2020-09-15T06:42:30.107Z
Cole Henley
<p>Good evening all,</p>
<p>I am updating a small site from Craft 2 to 3, and after <a href="https://craftcms.com/docs/3.x/upgrade.html#preparing-for-the-upgrade" rel="nofollow noreferrer">following the instructions</a> in the documents, I loaded up the backend of my site and was greeted with the install screen.</p>
<p>I know that this typically means that the <code>DB_TABLE_PREFIX</code> is improperly set, but I triple-checked and I'm 99% certain that it's correct. I double-checked with my Craft 2, which looks like</p>
<pre><code>// The prefix to use when naming tables. This can be no more than 5 characters.
    'tablePrefix' =&gt; 'craft',
</code></pre>
<p>And matched it to my <code>.env</code> file:</p>
<pre><code># The prefix that should be added to generated table names (only necessary if multiple things are sharing the same database)
DB_TABLE_PREFIX=craft
</code></pre>
<p>I also checked for a <code>craft_info</code> table, and that is present. The version listed in the version column is 2.9.2, if that makes a difference.</p>
<p>I am unable to login to my admin panel, or view my website now. I get the following when viewing my website:</p>
<pre><code>Database Connection Error – craft\errors\DbConnectException
Craft CMS can’t connect to the database with the credentials in config/db.php.
↵
Caused by: Database Exception – yii\db\Exception

</code></pre>
<p>Any help is greatly appreciated!</p>
<p>-Shad</p>

<database><updating>
Database Connection Error after updating from Craft 2 to 3
# Database Connection Error after updating from Craft 2 to 3

(Asked by: username_0 on 2020-09-15)

Good evening all,
I am updating a small site from Craft 2 to 3, and after following the instructions in the documents, I loaded up the backend of my site and was greeted with the install screen.
I know that this typically means that the DB_TABLE_PREFIX is improperly set, but I triple-checked and I'm 99% certain that it's correct. I double-checked with my Craft 2, which looks like
// The prefix to use when naming tables. This can be no more than 5 characters.
    'tablePrefix' => 'craft',

And matched it to my .env file:
# The prefix that should be added to generated table names (only necessary if multiple things are sharing the same database)
DB_TABLE_PREFIX=craft

I also checked for a craft_info table, and that is present. The version listed in the version column is 2.9.2, if that makes a difference.
I am unable to login to my admin panel, or view my website now. I get the following when viewing my website:
Database Connection Error – craft\errors\DbConnectException
Craft CMS can’t connect to the database with the credentials in config/db.php.
↵
Caused by: Database Exception – yii\db\Exception


Any help is greatly appreciated!
-username_0

**Tags:** database, updating


---

## 1 answers

### Answer by username_1 on 2020-09-15. Score: 0

Does the table prefix value in you .env file need to be in quotes? eg
DB_TABLE_PREFIX="craft"

> **Comments:**
> **username_1**: However - this sounds to me more like an issue with the credentials. Generally if the table prefix value is wrong Craft will just think it is not installed and try a new installation …  
> **username_0**: Thanks for the response. As noted above, the table prefix between Craft 2 and 3 is the same. The prefix wrapped in quotes wasn't the solution.  
> **username_1**: In Craft 3 I think you need to add the underscore for the prefix value so Craft 2 is `craft` but for Craft 3 would be `craft_`  
> **username_0**: Tried that yesterday, but still no luck. Thanks for checking back in though!  
> **username_2**: When the error message reads "can't connect to the database with the credentials" then you have a permissions error. Its not even reaching the db server thus it cannot be a problem with the table prefixes.  In a .env file, you do not need to use quotes unless there are spaces or other "special chars" in your term.  

---

