Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Laravel 4 Basics Laravel and Databases Connecting Laravel to MySQL

to separate DB set up Laravel?

to separate DB set up Laravel. It was working connect as local env app/local/database.php

'connections' => array(

        'mysql' => array(
            'driver'    => 'mysql',
            'host'      => 'localhost',
            'database'  => 'odot',
            'username'  => 'homestead',
            'password'  => 'secret',
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
        ),

Is possible to change the username and password on own?

            'username'  => 'homestead2',
            'password'  => 'secret2',

It could not get connect DB. It said failed to connect to MySQL at 127.0.0.1:33060 with user homestead2. access denied for user 'homestead2'@'10.0.2.2' (using password:YES)

I have two composer create projects called Laravel-basics and new-laracast. Those DB are set up work together. How would set up to separate DB? Is only one way to create new table?

4 Answers

Chris Shaw
Chris Shaw
26,676 Points

Hi Brian,

So if I'm understanding correctly you simply need another database for your second website? If so using something like HeidiSQL or Sequel Pro will allow you to remotely login into the MySQL server using port 33060.

From there you can create, delete, update your databases along with managing users and much more.

Hope that helps.

I check at hosts its same localhost.

127.0.0.1       laravel.dev
127.0.0.1       homestead.dev
127.0.0.1       Laracast.dev

I have not added the new ip address to separate db setup. How would you find the ip address for second website?

Are you looking to have two databases for one project?

Or create a new database for a new project?

I have two tables on mysql odot is for 127.0.0.1 I have already change on app/config/local/database.php 'database' => 'odot' the other one table is listaccout but its 'database' => 'listaccout'. those are same localhost of ip address related but both are separate. It seems fine so far... however I am looking for new ip address like on own domain to set up new database. I would like to learn more how to set up new ip address for new DB. I hope you understand.

Is 'username" => 'homestead' and 'password' =>'secret' because it would be even more convenience Laravel database config to connect and then change the username and password later?