Author | Message |
---|---|
smahbub2
Posts: 12
|
Posted 12:53 May 25, 2015 |
Hey, does anyone know how to use mysql on Macs? I only have to do the last problem(number 5) but it's problematic if I can't check if it worked or not. Any help would be appreciated. Thank you :) |
nbtang
Posts: 3
|
Posted 13:30 May 25, 2015 |
If you haven't already done so: Download mysql for mac: https://dev.mysql.com/downloads/mysql/ Once you have installed mysql or you already have mysql on mac: 1. Open Terminal 2. Type in: "sudo /usr/local/mysql/support-files/mysql.server start" without the quotation marks and press enter. MySQL should be starting. It should say something like "Starting MySQL... SUCCESS!" 3. After, type in: "cd /usr/local/mysql" without the quotation marks and press enter. 4. Finally to use mysql, type in: "./bin/mysql -u root" without the quotation marks and press enter. You can now start testing out your queries.
To quit MySQL: 1. Type in "quit" without quotation marks and press enter. 2. To end MySQL server, type in: "sudo /usr/local/mysql/support-files/mysql.server stop" without quotation marks and press enter. It should say something like "Shutting down MySQL... SUCCESS!"
Hope this helps. I'm also using MySQL on a mac.
|
Safa Al Mahbub
Posts: 13
|
Posted 14:01 May 25, 2015 |
Does it matter which one we download? |
nbtang
Posts: 3
|
Posted 14:29 May 25, 2015 |
Try downloading the first option.
A few things I forgot to include: If the terminal asks you for "Password" just type in your mac user's password and press enter, then it should say "Starting MySQL... SUCCESS!" Once you have MySQL up and running, you need to create a database for Kondas' lab questions, in order to import "lyric.sql" If you are greeted with: "Welcome to the MySQL Monitor..." you have MySQL up and running. Now, you just need to import lyric.sql in order to test out the queries. To do so: 1. Type in: "CREATE DATABASE lyric;" 2. Now check your databases with: "show databases;" You should have something like: 3. Now quit MySQL with "quit" and press enter. This way, we can now import the sql file. 4. Don't close the current terminal window. Download "lyric.sql" attached to this post and put it on your desktop. 5. In the terminal window, type in: "./bin/mysql -u root lyric < $HOME/Desktop/lyric.sql" without the quotation marks and press enter. It should blink for a few seconds. After that, you have imported the sql file, you can begin using MySQL with the lyric database. 6. Now, enter MySQL again, by doing: "./bin/mysql -u root" and press enter. 7. Load the lyric database by typing in: "use lyric;" 8. After all that, test it out with a simple query like this (to see if it works): "SELECT * FROM Members;" Each time, you want to use the lyric database for lab assignments when you launch mysql, you will always have to type in: "use lyric;" If everything works, you got MySQL up and running, along with importing the required sql file for lab assignments. |