<p>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!</p>

CC BY-SA 3.0
2016-10-25T15:59:54.993Z
2016-10-25T15:59:54.993Z
Jesse O'Neill
<p>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.</p>

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

<p>I followed a pretty detailed guide about setting up EC2 for craft here:
<a href="https://solspace.com/blog/spinning-up-a-craft-cms-development-site-on-amazon-ec2" rel="nofollow noreferrer">https://solspace.com/blog/spinning-up-a-craft-cms-development-site-on-amazon-ec2</a></p>

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

<blockquote>
  <p>"Service Unavailable</p>
  
  <p>Our site is temporarily unavailable. Please try again later."</p>
</blockquote>

<p>Then trying to login, I get a</p>

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

<p>With devmode on and looking at the console, its throwing me this error: </p>

<blockquote>
  <p>"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"</p>
</blockquote>

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

<p>My db.php</p>

<pre class="lang-php prettyprint-override"><code>// The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'.
'server' =&gt; 'localhost',

// The name of the database to select.
'database' =&gt; 'mydatabasename',

// The database username to connect with.
'user' =&gt; 'root',

// The database password to connect with.
'password' =&gt; 'root',

// The prefix to use when naming tables. This can be no more than 5 characters.
'tablePrefix' =&gt; 'craft',
</code></pre>

<p>Any help would be greatly appreciated!</p>

CC BY-SA 3.0
2016-10-11T21:29:50.280Z
Are you able to SSH into your EC2 instance and connect to MySQL with those credentials through the command line?
Brad Bell
CC BY-SA 3.0
2016-10-25T15:58:21.547Z
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
CC BY-SA 3.0
2016-10-25T18:05:19.853Z
It's always something like that!  Glad you're sorted.
Brad Bell
<database>
Transitioning local Craft site to AWS EC2
# Transitioning local Craft site to AWS EC2

(Asked by: username_0 on 2016-10-11)

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!

**Tags:** database
> **Comments:**
> **username_1**: Are you able to SSH into your EC2 instance and connect to MySQL with those credentials through the command line?  
> **username_0**: 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!  
> **username_1**: It's always something like that!  Glad you're sorted.  

---

## 1 answers

### Answer by username_0 on 2016-10-25. Score: 2 | Accepted answer

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!


---

