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

Development Tools Database Foundations Installing MySQL Server and MySQL Workbench Running a Script and Using MySQL Workbench

Should each database have a connection and schema?

I want to have one database to keep and one to test with. Just trying to figure out the best practices. Should I do this for each database:

  1. New mysql connection
  2. New database schema
  3. Input data into database using statements etc.

OR

  1. Create one mysql connection
  2. Create new database1 (or rather schema?)
  3. Import database2.sql (schema is part of .sql file)
  4. Keep adding schemas/databases and have them all show up in the schema tab all using a single mysql connection

I also realized that if you delete the same schema used by two databases it basically removes all data from both and you are left with no schema and empty databases (opps).

NOTE: I am using mySQL Workbench 6.1 on osx which looks different than video version

I tend to think multiple connections is the way to go based of mysql workbench docs.

mysql workbench

2 Answers

What I usually do is have at least two environments setup.

  1. My production server with its own schema, Production Environment
  2. My local box with is own schema, Development Environment

If you are going to have a big test suite to run against your code, it could be a good idea to make a second schema on your own box to run the tests against.

thanks william thats helpful. i wasn't sure how the models came into play with that local/production setup.