Answers.Body: <p>Here is how I have set things up in the past using a similar workflow. </p>
  
  <p>When you get Craft out of the box (for lack of better words) as you said there is a <code>craft</code> folder and a <code>public</code> folder. Generally you want your <code>craft</code> folder above/out of your web root. That would look something like this:</p>
  
  <pre><code>craft/
     |- app
     |- config
   ...
  
  public/
     |- index.php
     |- robots.txt
  </code></pre>
  
  <p>When setting up your site, point your <code>doc_root</code> to the <code>public/</code> folder.
  For example, if you are using a Mac, a default <code>doc_root</code> might look like this: </p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      ServerName sitename.dev
      DocumentRoot "/Applications/MAMP/htdocs/sitename/public"
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>If successful, you should see a screen saying that your site is unavailable. I can't remember the exact verbiage.</p>
  
  <p>From there I will edit two files:</p>
  
  <pre><code>/craft/config/db.php
  /craft/config/general.php
  </code></pre>
  
  <p><strong>db.php</strong></p>
  
  <pre><code>return array(
      '*' =&gt; array(  // Global configuration
          'tablePrefix' =&gt; ''
      ),
      '.dev' =&gt; array( // local configuration
          'server' =&gt; '127.0.0.1',
          'user' =&gt; 'username',
          'password' =&gt; 'password',
          'database' =&gt; 'database'
      ),
      '.com' =&gt; array( // production configuration
          'server' =&gt; 'hostname',
          'user' =&gt; 'username',
          'password' =&gt; 'password',
          'database' =&gt; 'database'
      )
  );
  </code></pre>
  
  <p><strong>general.php</strong></p>
  
  <pre><code>return array(
      '*' =&gt; array(
          'cpTrigger' =&gt; 'your-custom-admin-url',
          'omitScriptNameInUrls' =&gt; true
      ),
          '.dev' =&gt; array(  // local configuration
              'devMode' =&gt; true,
              'siteUrl' =&gt; 'http://mysite.dev/',
              'environmentVariables' =&gt; array(
                  'basePath' =&gt; $_SERVER['DOCUMENT_ROOT'] . '/',
                  'baseUrl' =&gt; 'http://mysite.dev/',
          )
      ),
      '.com' =&gt; array(  // production configuration
          'siteUrl' =&gt; 'http://www.mysite.com/',
          'environmentVariables' =&gt; array(
              'basePath' =&gt; $_SERVER['DOCUMENT_ROOT'] . '/',
              'baseUrl' =&gt; 'http://www.mysite.com'
          )
      )
  );
  </code></pre>
  
  <p>By having the <a href="https://craftcms.com/docs/multi-environment-configs" rel="nofollow">multi-environment settings</a> like the above, you can commit your code and it will run regardless of environment. </p>
  
  <p>Generally, I like to have a local database which is separate from my production db. My luck, I'll do something silly and delete something on accident. Depending on how big of changes you are making post-launch, I am sure there are good/better/best ways to migrate the updates to your production db vs. manually entering it. But, if they are simple things (added a new field) I usually just do that manually on my production server. </p>
  
  <p>It sounds like if you <em>can</em> connect to your production db via a 3rd party tool, but not your application there might be some permission trouble (just a guess). Try working locally with everything first, then move it to your other server.</p>
  
  <p>Hope this helps!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-01T09:28:02.760Z
Answers.Text: Thanks for the help I've been able to set it all up locally (downloaded the database and installed it locally), the virtual host is being handled perfectly by MAMP Pro (I've went and checked the httpd.conf file) so that's all OK :-).
  But... I'd like to use my files locally and connect with the online database since I set up the craft control panel first and only do some small changes later (e.g. to rename a handle) and add some dummy content to do the theming. To me, it seems a bit to much to always have to upload the local database again. Or am I wrong and should I start working like that?
Answers.UserDisplayName: Jan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-01T11:53:55.753Z
Answers.Text: That's totally up to you. I am (personally) always scared of messing something up on production.
   
  Just a total guess here, but you may have to use a different IP to connect through your application. I know I have an external IP and an internal IP I use for 3rd party tools like sequel pro. Then usually the internal IP gets used within my application.
Answers.UserDisplayName: Damon
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-31T11:11:44.603Z
Answers.LastActivityDate: 2016-03-31T11:11:44.603Z
Answers.UserDisplayName: Damon
Body: <p>So... I've installed Craft online, and I wanted to start templating my CraftCMS, but I'd like to work with a repository so I can have some kind of versioning. The easiest way to do so seemed to me to install Craft on our hosting server, download those files locally and connect to the online database using MAMP pro.
  I had some issues with our host (I had to whitelist my IP address), but now I can connect to the database using Sequel Pro, but when I try to access my craft CMS site through my local files I get the Craft message "service unavailable".
  My Mamp Pro is pointed to my public folder (2 folders in my site: public and craft, and it's pointed to this public folder with the index file in it) and I've used the same db settings as the ones I've used in Sequal Pro. Still: no succes.
  The only thing I've changed after downloading the site are these db setting for the host - as I had to do in Sequal Pro.
  Can anyone help a newbie in Craft CMS out here :-)? Thanks!</p>
  
Tags: <mamp>
Title: Craft install locally with MAMP Pro/versioning
ThreadText: # Craft install locally with MAMP Pro/versioning
  
  (Asked by: username_0 on 2016-03-31)
  
  So... I've installed Craft online, and I wanted to start templating my CraftCMS, but I'd like to work with a repository so I can have some kind of versioning. The easiest way to do so seemed to me to install Craft on our hosting server, download those files locally and connect to the online database using MAMP pro.
  I had some issues with our host (I had to whitelist my IP address), but now I can connect to the database using Sequel Pro, but when I try to access my craft CMS site through my local files I get the Craft message "service unavailable".
  My Mamp Pro is pointed to my public folder (2 folders in my site: public and craft, and it's pointed to this public folder with the index file in it) and I've used the same db settings as the ones I've used in Sequal Pro. Still: no succes.
  The only thing I've changed after downloading the site are these db setting for the host - as I had to do in Sequal Pro.
  Can anyone help a newbie in Craft CMS out here :-)? Thanks!
  
  **Tags:** mamp
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-03-31. Score: 2
  
  Here is how I have set things up in the past using a similar workflow.
  
  When you get Craft out of the box (for lack of better words) as you said there is a `craft` folder and a `public` folder. Generally you want your `craft` folder above/out of your web root. That would look something like this:
  
  ```
  craft/
     |- app
     |- config
   ...
  
  public/
     |- index.php
     |- robots.txt
  
  ```
  
  When setting up your site, point your `doc_root` to the `public/` folder.
  For example, if you are using a Mac, a default `doc_root` might look like this:
  
  ```
  <VirtualHost *:80>
      ServerName sitename.dev
      DocumentRoot "/Applications/MAMP/htdocs/sitename/public"
  </VirtualHost>
  
  ```
  
  If successful, you should see a screen saying that your site is unavailable. I can't remember the exact verbiage.
  
  From there I will edit two files:
  
  ```
  /craft/config/db.php
  /craft/config/general.php
  
  ```
  
  **db.php**
  
  ```
  return array(
      '*' => array(  // Global configuration
          'tablePrefix' => ''
      ),
      '.dev' => array( // local configuration
          'server' => '127.0.0.1',
          'user' => 'username',
          'password' => 'password',
          'database' => 'database'
      ),
      '.com' => array( // production configuration
          'server' => 'hostname',
          'user' => 'username',
          'password' => 'password',
          'database' => 'database'
      )
  );
  
  ```
  
  **general.php**
  
  ```
  return array(
      '*' => array(
          'cpTrigger' => 'your-custom-admin-url',
          'omitScriptNameInUrls' => true
      ),
          '.dev' => array(  // local configuration
              'devMode' => true,
              'siteUrl' => 'http://mysite.dev/',
              'environmentVariables' => array(
                  'basePath' => $_SERVER['DOCUMENT_ROOT'] . '/',
                  'baseUrl' => 'http://mysite.dev/',
          )
      ),
      '.com' => array(  // production configuration
          'siteUrl' => 'http://www.mysite.com/',
          'environmentVariables' => array(
              'basePath' => $_SERVER['DOCUMENT_ROOT'] . '/',
              'baseUrl' => 'http://www.mysite.com'
          )
      )
  );
  
  ```
  
  By having the [multi-environment settings](https://craftcms.com/docs/multi-environment-configs) like the above, you can commit your code and it will run regardless of environment.
  
  Generally, I like to have a local database which is separate from my production db. My luck, I'll do something silly and delete something on accident. Depending on how big of changes you are making post-launch, I am sure there are good/better/best ways to migrate the updates to your production db vs. manually entering it. But, if they are simple things (added a new field) I usually just do that manually on my production server.
  
  It sounds like if you *can* connect to your production db via a 3rd party tool, but not your application there might be some permission trouble (just a guess). Try working locally with everything first, then move it to your other server.
  
  Hope this helps!
  
  > **Comments:**
  > **username_0**: Thanks for the help I've been able to set it all up locally (downloaded the database and installed it locally), the virtual host is being handled perfectly by MAMP Pro (I've went and checked the httpd.conf file) so that's all OK :-). But... I'd like to use my files locally and connect with the online database since I set up the craft control panel first and only do some small changes later (e.g. to rename a handle) and add some dummy content to do the theming. To me, it seems a bit to much to always have to upload the local database again. Or am I wrong and should I start working like that?  
  > **username_1**: That's totally up to you. I am (personally) always scared of messing something up on production.   Just a total guess here, but you may have to use a different IP to connect through your application. I know I have an external IP and an internal IP I use for 3rd party tools like sequel pro. Then usually the internal IP gets used within my application.  
  
  ---
  
  