Friday, 10 April 2015

Database connection in laravel

This post is about creating a database connection in laravel.Connecting to database is quite simple and you need not take any pain in the process.So lets start.Before we create a connection to database we need a create so lets first create a database.If you know this step you can skip this process.I will be using CMD to create a database example with table users having fields id auto increment,name varchar,country varchar.
I'm attaching a screen shot of my CMD.Please preview it by clicking on it since it is appearing small.




Ignore the errors which i got while executing the queries :p
Now lets create a connection to this database go to app/config and open database.php.Search for this block of code


Change the DB_DATABASE to example,DB_USERNAME to root,DB_PASSWORD to root.(Yours credentials may defer )



Thats all folks and we are done with database connectivity :)

6 comments:

  1. hello ! kiran sadvilkar visit please give me an idea can i buy this gig from fiverr.com Laravelhttps://www.fiverr.com/ahmedwali5990/be-your-laravel-website-expert

    ReplyDelete
  2. Hi,

    Thank you so much for share your thoughts. I will definitely appreciate your ideas about Laravel Framework Development .

    Laravel Development
    Aapthi Technologies
    Ecommerce Web Development Company

    ReplyDelete
  3. This guidance was really new for me, and I found it genuinely advantageous for myself. I am obliged to you for sharing this piece of guidance here. Keep sharing.
    Website Design Agency | Website design company

    ReplyDelete
  4. Thanks for sharing the informative blog about Database connectivity in Laravel.

    Web Designing Company in Coimbatore

    ReplyDelete
  5. Your post on database connection in laravel is very helpful. Thank you for sharing.
    Laravel Web Development Services

    ReplyDelete