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 trialSean Flanagan
33,235 PointsCan't import treehouse_movie_db
Hi. I've downloaded this file and opened it but I can't import it despite clicking Refresh All. Consequently all the execute options are greyed out. I've tried going to the Start menu on my desktop, clicking Run and typing services.msc
in the text box but had no joy.
I'd be grateful for any help.
5 Answers
Jason Anello
Courses Plus Student 94,610 PointsHi Sean,
Are you following all the steps from this video? https://teamtreehouse.com/library/database-foundations/installing-mysql-server-and-mysql-workbench/running-a-script-and-using-mysql-workbench-2
If so, let us know at which point in the video your results start to differ.
Sean Flanagan
33,235 PointsHi Jason. Nice to hear from you again as always.
Yes, I have the first three tables but not the last two. No "reviews" or "users".
I can see no commands in the SQL file to create those two tables.
This is a product of my Google search for "CREATE TABLE users" minus the quotes. http://snipplr.com/view/14738/create-table-users/
No luck in my Google "CREATE TABLE reviews" search. Google seems to think I'm looking for real-life reviews rather than something named "reviews" if you get my drift. I'll show you what I mean: https://www.google.co.uk/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=CREATE+TABLE+reviews. So I tried a different search: mysql CREATE TABLE called reviews. I got about 593,000 results. Here's a link to one of the results: http://dba.stackexchange.com/questions/95696/creating-database-tables-for-reviews-functionality-that-incorporates-tags-catego
I hope this helps. Thanks Jason.
Sean :-)
Jason Anello
Courses Plus Student 94,610 PointsI'm sorry Sean, I wasn't clear in my comment. I didn't mean a google search. I meant to search the sql file that you have to see if it has commands to create those 2 tables you're missing. But it sounds like you did that in step 2 already.
Maybe you have the wrong sql file then. The one I downloaded has 13379 lines. Last line is blank. Compare with your file.
Did you download the one in the Teacher's Notes for this video?
Here's a direct link to it: http://treehouse-code-samples.s3.amazonaws.com/DBFoundations/stage_7/treehouse_movie_db.sql
Try downloading that file and running through the import steps again. Post back if you still don't have the 5 tables.
The script will drop your existing treehouse_movie_db if you have one in there and create a fresh new one. Hopefully. :)
Sean Flanagan
33,235 PointsYes I did download the one in the Teacher's Notes. I clicked on the tab called unconnected. I looked at the treehouse_movie_db file. It does have 13,379 lines like you said, and the last line is also blank so I must have looked at the wrong one before. Apologies.
There's another tab called Local instance MySQL57 and this hosts another file called SQL File 3. Below are the contents of SQL File 3:
SELECT movies.title AS movie_title, genres.name AS genre_name
FROM movies LEFT OUTER JOIN genres
ON movies.genre_id = genres.id
WHERE genres.actorsactorsgenresgenresmoviesmoviesactorsactorsgenresgenresmoviesmoviesgenresgenresactorsactorsid = 1;
There are only 3 tables here: actors, genres and movies.
Jason Anello
Courses Plus Student 94,610 PointsOk, it sounds like you have the correct file . You want the treehouse_movie_db.sql file that's 13,000+ lines.
When you have that tab selected is the lightning bolt to execute the script yellow or greyed out?
If it's greyed out then it means you're not connected to mysql. You'll need to connect to your mysql database. Is this what you're having trouble with?
If the lightning bolt is yellow then you should be able to click it and it will create the database with all 5 tables. Make sure you don't have any part of the file selected/highlighted or it will only execute that portion. You want the whole thing executed.
I just tried it out and it works for me. I have all 5 tables.
Sean Flanagan
33,235 PointsHi Jason. Yes I am struggling to link to MySQL. The tab at the top of the screen called unconnected isn't linked to MySQL but the one beside it, called Local instance MySQL57, with a file called SQL File 3, is connected.
Jason Anello
Courses Plus Student 94,610 PointsSorry this is taking so much back and forth.
Maybe you're executing that sql script in the wrong tab then.
Try this if you haven't already.
If the MySQL57 tab is connected to MySQL then make sure you have that tab selected.
Go to "File" then "Open SQL Script..." Navigate to where you saved "treehouse_movie_db.sql" and open it.
You should then see the contents of the sql file and the lightning bolt should be yellow. Clicking on that should create the database with all 5 tables populated.
Sean Flanagan
33,235 PointsHi Jason. No problem; sometimes finding a solution takes a lot longer than you expect.
I did as you suggested and it worked. All three lightning bolts are yellow. I clicked on Execute and then Refresh All and hey presto, we are in business! It's working now.
From the bottom of my heart, thank you Jason. You've been a terrific help! :-)
Sean
Jason Anello
Courses Plus Student 94,610 PointsYou're welcome.
Thanks for hanging in there.
Sean Flanagan
33,235 PointsSean Flanagan
33,235 PointsHi Jason. Thanks for your reply. Sorry for the delay.
I've got a schema called treehouse_movie_db but it's missing two tables: reviews and users.
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsI downloaded the sql file associated with this video and opened it in a text editor to look at it..
It's creating 5 tables as far as I can tell. 'actors', 'genres', 'movies', 'reviews', and 'users'
Are you saying that you have the first 3 but not reviews and users?
Can you check the sql file you have and see if there are any commands to create those 2 tables?
Do a search for "CREATE TABLE
users
" without the double quotes and see if it's in there. It appears on line 13,348 in the sql file I have.And do a similar search for the reviews table to make sure there are commands to create that table and populate it.
I'm not sure if your sql file is missing these tables or something is going wrong with the import.