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

General Discussion

Andrew Chalkley
STAFF
Andrew Chalkley
Treehouse Guest Teacher

Database Foundations: Stage 2 - Installing MySQL Server and MySQL Workbench Launched

Installing MySQL Server and MySQL Workbench has just launched. We cover installing the MySQL Server and Workbench on Windows and OS X. We also show you how to seed the database with a script file and how to use the MySQL Workbench.

Get it while it's hot!

17 Answers

James Barnett
James Barnett
39,199 Points

That's some impressive turn around under 20 hours.

I'm so excited you are covering MySQL Workbench, not enough tutorials on MySQL cover that awesome tool.

I've been looking for something just like this! I'm in software quality assurance and work with databases frequently. Unfortunately, I haven't had much training with databases so I occasionally struggle when working with them. These modules will definitely help me understand the basics and become more proficient in my job. Thanks!

Andrew,

On this section - http://teamtreehouse.com/library/programming/database-foundations/installing-mysql-server-and-mysql-workbench/installing-mysql-server-and-workbench-on-os-x

Having some trouble with setting up the config file.

When I type in this: "sudo cp /usr/local/mysql/support-files/m"

This is what I see:

usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_director

I'm wondering if I made an error during the installation.

Andrew Chalkley
STAFF
Andrew Chalkley
Treehouse Guest Teacher

The command is sudo cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf

sudo cp is the command /usr/local/mysql/support-files/my-default.cnf is the source_file and /etc/my.cnf` is the target_file.

You're only typing part of the source_file after the command.

You can copy and paste the command in to your terminal.

Thanks!

You make an excellent teacher, Andrew! I'm new to Treehouse, having started out in database foundations, and I'm not sure what to expect regarding scheduled roll-out of the full course. Is there an ETA for stage 3, and/or what is a typical timeline for stage releases at Treehouse?

Andrew Chalkley
STAFF
Andrew Chalkley
Treehouse Guest Teacher

Thanks Chris and welcome to Treehouse!

Stage 3 is in post-production (video editing) at the moment. Then it'll go over to QA.

In general we aim to get new stages out every 2 weeks or ~2 a month.

We update our Roadmap here with approximations.

Hey Andrew, your videos have already been a huge help to me so far, you make it all very easy to understand. The one problem I'm having is that when I try to create a server instance it tells me that there is no connection to the MySQL server. I followed all the installation instructions precisely but I can't seem to get it to connect. I also ran the sudo command and double checked in Terminal to make sure that the "my.cnf" file was copied properly into the etc directory. My startup message log shows me this:

2013-05-28 22:50:54 - Checked server status: Server is stopped. 2013-05-28 22:50:58 - Starting server... 2013-05-28 22:50:58 - Start server: usage: sudo [-n] -h | -K | -k | -L | -V | -v usage: sudo -l[l] [-AnS] [-g groupname|#gid] [-U username] [-u username|#uid] [-g groupname|#gid] [command] usage: sudo [-AbEHnPS] [-C fd] [-g groupname|#gid] [-p prompt] [-u username|#uid] [-g groupname|#gid] [VAR=value] [-i|-s] [<command>] usage: sudo -e [-AnS] [-C fd] [-g groupname|#gid] [-p prompt] [-u username|#uid] file ...

2013-05-28 22:50:59 - Checked server status: Server is stopped. 2013-05-28 22:50:59 - Server start done.

Thanks so much for all of your help so far (in the videos) and for any help you can provide me with this issue.

Andrew Chalkley
STAFF
Andrew Chalkley
Treehouse Guest Teacher

Hi Guru,

I'm guessing you're on Mac OS X.

Are you getting this is the WorkBench client? Have you tried rebooting your system?

If you type cat /etc/my.cnf in your terminal do you get a stream of output in your terminal like:

...
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

Hi Andrew,

Thanks for the Database tutorials - treehouse is a great resource! I am having an issues in the Installing MySQL Server and Workbench on OS X. When I go to the MySQL workbench to start there server I get the following:

2013-07-20 10:55:46 - Starting server...
2013-07-20 10:55:46 - Start server: usage: sudo [-n] -h | -K | -k | -L | -V | -v
    usage: sudo -l[l] [-AnS] [-g groupname|#gid] [-U username] [-u username|#uid]
            [-g groupname|#gid] [command]
usage: sudo [-AbEHnPS] [-C fd] [-g groupname|#gid] [-p prompt] [-u
            username|#uid] [-g groupname|#gid] [VAR=value] [-i|-s]     [<command>]
usage: sudo -e [-AnS] [-C fd] [-g groupname|#gid] [-p prompt] [-u
        username|#uid] file ...

2013-07-20 10:55:46 - Checked server status: Server is stopped.
2013-07-20 10:55:46 - Server start done.
2013-07-20 10:55:46 - Checked server status: Server is stopped.

I followed the suggestion you (Andrew) made above (rebooting system) and entered cat /etc/my.cnf into the terminal and received the following message:

...
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

I'm not entirely sure where to go from here...any direction would be super helpful! Thanks

Andrew Chalkley
Andrew Chalkley
Treehouse Guest Teacher

So after you press start it starts and stops automatically?

Andrew,

Yes - exactly.

Andrew Chalkley
Andrew Chalkley
Treehouse Guest Teacher

Odd. I've seen when I've mistyped my password when trying to stop it says stopping and then says it's started.

Have you saved the default password the workbench app will try and use?

Hey Andrew,

Thank you very much for the quick response. Yep I'm on OS X, sorry for not specifying before. I figured it out and embarrassingly for myself the problem was simply that the server wasn't running. I am very new to MySQL Workbench and didn't quite understand how the server instances work. I thought that maybe they were supposed to run the server as part of the process. In the video there isn't a specific step that tells you to run the server before creating a server instance, but maybe that's supposed to happen automatically when you install MySQL Community Server and my computer just didn't do it for some reason. Anyway I ran the server from Terminal and that fixed the problem, and then I remembered the MySQL server utility that you helped me install into the System Preferences. I tried running and stopping the server from there and it worked as well. Thank you so much for all of your help and I look forward to finishing the series and finally understanding databases. Thanks again!

Robert Ho
PLUS
Robert Ho
Courses Plus Student 11,383 Points

Hey Andrew,

I think Guru has a point. Where in the Introduction to Installation of MySQL videos does it tell you to initialize or execute mySQL and how do you go about doing it? Thanks!

-Robert

Andrew Chalkley
STAFF
Andrew Chalkley
Treehouse Guest Teacher

Hi Guru Khalsa and Robert Ho,

I'll see if I can corner a video pro tomorrow to see if there was an error in editing.

I'll report my findings :)

Regards Andrew

Andrew Chalkley
STAFF
Andrew Chalkley
Treehouse Guest Teacher

I double checked the footage and it wasn't edited, it seems that the optional step of installing the preference pane started it.

But I think if it's not running, when creating an "Instance" to manage it will prompt you to start it. You need to create an "Instance" that's running before you run your queries with the Query Browser.

Robert Ho
PLUS
Robert Ho
Courses Plus Student 11,383 Points

Andrew, at what point does the mySQL "start?" Like at what point during the video, installation of the software, etc etc.

Andrew Chalkley
Andrew Chalkley
Treehouse Guest Teacher

I looks like it did automatically (?) for me but if you see it stopped @ 4:06 you should start it then. If not you should be prompted around the 7 minute mark through setting up and instance and checking for connection.

hello Andrew, im loving your video,, i installed both the server and workbench but the later is not showing any thing other than the shortcuts and that one model and and to add connection , what should i do ?

Craig Salmond
PLUS
Craig Salmond
Courses Plus Student 7,438 Points

I'm running Mavericks on OS X and when I type the sudo command (copied from above) to copy the config file, it says "No such file or directory." Could it be a problem with Mavericks?

Andrew Chalkley
Andrew Chalkley
Treehouse Guest Teacher

There may have been an update to the installer and for some reason they may not have included the my-default.cnf any more.

Can you open up your terminal and type this:

cd /usr/local/mysql/support-files/

This will navigate you in to a directory that should contain example config files. Type the ls command in the terminal.

You may see a my-small.cnf, a my-medium.cnf and a my-large.cnf.

If you do you may just need to experiment with the different sizes for your machine.

sudo cp /usr/local/mysql/support-files/my-small.cnf /etc/my.cnf

If the above doesn't work when trying to start the mysql server try

sudo cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf

or

sudo cp /usr/local/mysql/support-files/my-large.cnf /etc/my.cnf

Let me know how you get on!

Craig Salmond
PLUS
Craig Salmond
Courses Plus Student 7,438 Points

Sorry, it was a stupid mistake. I already had MAMP installed and I intended to use it for MySQL, so naturally there wouldn't be a config file in a location that didn't exist. I did get it working though. Thanks, and sorry for the hassle!