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 trialHenrik Christensen
Python Web Development Techdegree Student 38,322 PointsPHP database MAMP
Hi,
I just finished my first website in php and now the next step is to learn about databases. I've been looking around here on treehouse and google, but I can't really figure this out:
- When I create a new database locally (MAMP) do I then upload this to my hosting site when I finish my project?
- Or do I keep the MAMP database on my computer and then create a new one on my hosting site?
I'm asking because my hosting site (dreamhost) has this option to create a new database and because there don't really seem to be any instruction about creation and uploading of databases.
3 Answers
Boris Kamp
16,660 Pointsnormally you would build your site locally and when finished, copy all your content to the live server. This includes your database. So you would keep it locally and on the live server. The local database will not be used anymore I guess? just for development. All the changes you make with content will be made on the live server.
Do you use a cms system?
Henrik Christensen
Python Web Development Techdegree Student 38,322 PointsAhh.. I just found this course: (https://teamtreehouse.com/library/database-foundations). This might be helpful solving my problem :-)
Tim Knight
28,888 PointsHenrik,
Using MAMP is a great way to get things started on your local computer. But yes once you're finished what you'd do is run an export within your MAMP's PHPMyAdmin. You'd then create a new database on your host and then import your database file into that new database.
So in MAMP click on your database section and click for PHPMyAdmin, click on your database on the left side of the new browser interface that opened for PHPMyAdmin, and then on the right section of the screen you'll see an export tab, click that. The default settings are typically just fine, then press Go. This will give you a SQL file. So then on your host, you can create a database of the same name and then either use whatever import tools they have or copy and paste the contents of that SQL file to be excited by the database server. Each individual host should be able to give you guidance as to their particular process. Definitely watch the Database Foundations course it'll give you a much better idea as to what's going on in that SQL file.
Boris Kamp
16,660 Pointslike this, exactly
Henrik Christensen
Python Web Development Techdegree Student 38,322 PointsHenrik Christensen
Python Web Development Techdegree Student 38,322 PointsSorry if I mis-understand but you're saying if I create the DB locally and then upload it to the hosting server then it would still work? I don't need to create a new DB on the hosting server?
All I use so far is MAMP and brackets (text-editor).