0

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!

-Shad

0

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

DB_TABLE_PREFIX="craft"
5
  • 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 … Sep 15 '20 at 6:43
  • 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
    Sep 15 '20 at 15:16
  • 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_ Sep 16 '20 at 16:05
  • Tried that yesterday, but still no luck. Thanks for checking back in though!
    – Shad
    Sep 16 '20 at 19:15
  • 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
    Feb 12 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.