Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
joshualande committed Apr 24, 2014
1 parent 10408a8 commit 175b5e6
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 24 deletions.
17 changes: 7 additions & 10 deletions _drafts/2014-04-18-create-tables-sql.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ comments: true
permalink: create-tables-sql
---

*This is the second post in a [series of posts]({% post_url 2014-04-17-data-science-sql %})
about doing data science with SQL.

![Sequel Pro Connect Tab](/assets/sequel_pro_connect_tab.jpg)
I will then go over the
commands required to set up the example recpie database from the
[previous post]({% post_url 2014-04-18-database-normalization %}).
By the end of this post, you will have a working database!



Expand All @@ -20,14 +25,6 @@ to first create a database to work in:
To run SQL commands, you can either connect to SQL
through the command line with the command

XXXX

Alternately, you can connect to Sequel Pro
or go to the Query menu in
Sequel Pro


![Sequel Pro Content Tab](/assets/sequel_pro_content_tab.jpg)


```sql
Expand Down Expand Up @@ -133,7 +130,7 @@ To view the table
SELECT * FROM recipe_ingredients
```

![Sequel Pro Query Tab](/assets/sequel_pro_query_tab.jpg)
![Sequel Pro Content Tab](/assets/sequel_pro_content_tab.jpg)


<!--
Expand Down
57 changes: 43 additions & 14 deletions _drafts/2014-04-24-setup-mysql.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
layout: post
title: "How to Setup MySQL"
title: "How to Setup MySQL On Your Local Machine"
comments: true
permalink: setup-mysql
---
Expand All @@ -10,11 +10,8 @@ about doing data science with SQL. The [previous post]({% post_url 2014-04-18-da
described the topic of database normalization and good database design.*

In this post, I will describe how to setup [MySQL](http://www.mysql.com/)
on your local machine. MySQL is great because it is popular, open
source, and easy to get started with. I will then go over the
commands required to set up the example recpie database from the
[previous post]({% post_url 2014-04-18-database-normalization %}).
By the end of this post, you will have a working database!
on your local machine. MySQL is great for learning about SQL because
it is popular, open source, and easy to get started with.

## Setting up SQL On Your local Machine

Expand All @@ -25,11 +22,26 @@ or
In particular, you can get the installer
[here](http://dev.mysql.com/downloads/mysql/).

In the process of setting up MySQL, you will need to create a root
account. SQL is built to have robust permissions around who can do
what, but for testing, it is fine to use your root account.
On a Mac, you can download a DMG, double click to install,
and then step through the installation process.
Also, the Mac DMG comes with a startup package which will automatically
launch MySQL when you turn on your computer and adds
a convenient menu in the System Preferences for managing MySQL:

To connect to the MySQL dateabase, you can issue the
![MySQL System Preferences](/assets/mysql_system_preferences.jpg)

After you setup MySQL, you can set up the root MySQL account
from the terminal using the command:

```
$mysqladmin -u root password: XXXXXXXXXXXX
```

SQL has robust permissions so that different accounts can have
different access/privealges. This is good in a production
environment, but for now logging in as root is fine.

You can connect to the MySQL database from the commandline:

```bash
$ mysql -u root --host=localhost --password
Expand All @@ -49,9 +61,9 @@ Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> ...
```

From the terimal, you can issue SQL commands.
From the terimal, you are ready to issue SQL commands.

# Sequel Pro on OS X
# The Sequel Pro SQL Client on OS X

If you are using an Apple computer, I recommend using the free and
open-source graphical program [Sequel Pro](http://www.sequelpro.com/).
Expand All @@ -60,7 +72,24 @@ a friendly graphical user interface instaed of the commandline.
It also simplifies the process of viewing tables and inspecting
other database properties.

Once MySQL is set up, you can connect to it with your root
username and password:
![Sequel Pro Connect Tab](/assets/sequel_pro_connect_tab.jpg)

Once you install Sequel Pro, you connect to it with your username
and password as above.

Inside of SQL Pro, there is a query menu
where you can issue SQL commands.

![Sequel Pro Query Tab](/assets/sequel_pro_query_tab.jpg)

# Other MySQL Programs

If you prefer, there are several other programs for connecting to
a MySQL database.

* MySQL Workbench ([link](http://dev.mysql.com/downloads/tools/workbench/))
* DBVisualizer ([link](http://www.dbvis.com/))
* phpMyAdmin ([link](http://www.phpmyadmin.net/home_page/))
* HeidiSQL ([link](http://www.heidisql.com/))

{% include twitter_plug.html %}
Binary file modified assets/sequel_pro_query_tab.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 175b5e6

Please sign in to comment.