1

First post here and I am a complete newbie when it comes to Craft and any kind of server config but I am trying to learn.

I am trying get my Craft site that I built locally up to a server today.

I followed a pretty detailed guide about setting up EC2 for craft here: https://solspace.com/blog/spinning-up-a-craft-cms-development-site-on-amazon-ec2

The issue I'm running into is that when I go to my EC2 URL I'm getting a

"Service Unavailable

Our site is temporarily unavailable. Please try again later."

Then trying to login, I get a

"Craft can’t connect to the database with the credentials in craft/config/db.php."

With devmode on and looking at the console, its throwing me this error:

"install:82 [16:36:40.799][error][exception.Craft\DbConnectException] exception 'Craft\DbConnectException' with message 'Craft can’t connect to the database with the credentials in craft/config/db.php.' in /var/www/craft/app/etc/behaviors/AppBehavior.php:855"

So clearly Craft is unable to find the database that I created locally but I'm not really sure how to fix this.

My db.php

// The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'.
'server' => 'localhost',

// The name of the database to select.
'database' => 'mydatabasename',

// The database username to connect with.
'user' => 'root',

// The database password to connect with.
'password' => 'root',

// The prefix to use when naming tables. This can be no more than 5 characters.
'tablePrefix' => 'craft',

Any help would be greatly appreciated!

  • Are you able to SSH into your EC2 instance and connect to MySQL with those credentials through the command line? – Brad Bell Oct 11 '16 at 21:29
  • Yes, I was. Figured out the issue. I had one character off in my MySQL database versus what I was telling craft it was called in the db.php file. User error prevails again! – Jesse O'Neill Oct 25 '16 at 15:58
  • It's always something like that! Glad you're sorted. – Brad Bell Oct 25 '16 at 18:05
2

Figured out the issue. I had one character off in my MySQL database name versus what I was telling craft it was called in the db.php file which is why it was failing to access it. User error prevails again!

| improve this answer | |

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.