1 00:00:00,270 --> 00:00:00,960 All right. 2 00:00:00,960 --> 00:00:04,910 So to start the installation process, we'll go to the MySQL website. 3 00:00:04,920 --> 00:00:10,290 There's a link as a resource attached to this video, and then we'll go to downloads and click on the 4 00:00:10,290 --> 00:00:12,030 community download section. 5 00:00:12,030 --> 00:00:15,180 We don't need any of the fancy stuff, community downloads. 6 00:00:15,180 --> 00:00:18,750 And then specifically what we want is the community server. 7 00:00:19,140 --> 00:00:23,760 So for Mac, there's a fancy installer, but for Windows rather for Mac there is not. 8 00:00:23,760 --> 00:00:25,530 So we have to install it. 9 00:00:25,530 --> 00:00:29,130 It still is very easy, but we don't get everything all bundled together. 10 00:00:29,130 --> 00:00:34,920 Make sure you click the installation download that matches your architecture for your Mac. 11 00:00:35,070 --> 00:00:36,720 So I'll click download. 12 00:00:37,140 --> 00:00:37,770 We can click. 13 00:00:37,770 --> 00:00:38,580 No thanks. 14 00:00:38,580 --> 00:00:39,840 We don't want to sign up. 15 00:00:39,840 --> 00:00:41,130 We don't need to sign up. 16 00:00:41,130 --> 00:00:43,380 And then hopefully that finishes up. 17 00:00:43,560 --> 00:00:50,160 Launch the little installer here and my Mac is going to complain to me that it doesn't trust it, so 18 00:00:50,160 --> 00:00:52,110 I have to go to my system preferences. 19 00:00:52,920 --> 00:00:57,360 Go to the security and privacy pane and then click open anyway. 20 00:00:58,400 --> 00:01:00,320 Which you can see right here. 21 00:01:00,740 --> 00:01:01,670 Open anyway. 22 00:01:03,670 --> 00:01:06,160 Type my password in, do all that stuff. 23 00:01:08,150 --> 00:01:10,580 And then it should open the installer. 24 00:01:10,610 --> 00:01:13,030 Okay, so now that's done. 25 00:01:13,040 --> 00:01:17,990 At least the installer is open and I'll click continue, scroll through the terms. 26 00:01:17,990 --> 00:01:18,800 Agree. 27 00:01:19,940 --> 00:01:21,200 And then click install. 28 00:01:22,550 --> 00:01:25,720 You will need a decent amount of space, 700 and something gigs. 29 00:01:25,730 --> 00:01:29,030 I have to type my computer password or at least my account password. 30 00:01:31,520 --> 00:01:33,860 And it doesn't take all that long. 31 00:01:34,040 --> 00:01:35,680 I'll leave that option checked. 32 00:01:35,690 --> 00:01:36,530 Click next. 33 00:01:36,560 --> 00:01:37,970 Now, this is very important. 34 00:01:38,270 --> 00:01:40,550 We need to set up a password for the root user. 35 00:01:40,580 --> 00:01:44,450 Now, this can be whatever you want, but you need to remember what it is because you're going to have 36 00:01:44,450 --> 00:01:46,320 to enter it later in this video. 37 00:01:46,340 --> 00:01:48,210 So put some password in there. 38 00:01:48,230 --> 00:01:51,800 It doesn't have to match your computer password, whatever you want. 39 00:01:51,860 --> 00:01:59,090 Root user is the top level main user of your SQL Server, so you can change that password, but remember 40 00:01:59,090 --> 00:01:59,990 what you put in there. 41 00:02:00,440 --> 00:02:03,110 And then it's asking me for my Mac, my computer password. 42 00:02:03,110 --> 00:02:05,470 Again, that's not my SQL password. 43 00:02:05,480 --> 00:02:07,340 And then that should finish. 44 00:02:08,180 --> 00:02:08,900 Soon. 45 00:02:08,900 --> 00:02:09,590 There we are. 46 00:02:09,620 --> 00:02:12,590 We'll click close and we have installed the server. 47 00:02:12,680 --> 00:02:13,010 All right. 48 00:02:13,010 --> 00:02:15,340 So the next thing we're going to do, it's installed. 49 00:02:15,350 --> 00:02:16,010 That's it. 50 00:02:16,010 --> 00:02:19,880 But now we need to actually try using the command line client. 51 00:02:19,880 --> 00:02:23,000 So what I'm going to do is open up my terminal. 52 00:02:23,000 --> 00:02:25,910 I'm just gonna use the basic terminal app. 53 00:02:26,480 --> 00:02:29,800 Now, if you have some other terminal app you like to use, you can use that instead. 54 00:02:29,810 --> 00:02:30,540 Here's mine. 55 00:02:30,560 --> 00:02:33,230 It might look a little bit different than yours, but it doesn't matter. 56 00:02:33,260 --> 00:02:35,710 All right, so now let's test the install out. 57 00:02:35,720 --> 00:02:39,050 We're probably going to have a bad time if I try running the command. 58 00:02:39,050 --> 00:02:43,670 My SQL, that is the command will use to open up the MySQL interactive shell. 59 00:02:43,970 --> 00:02:45,860 It tells me command not found. 60 00:02:45,890 --> 00:02:48,040 Now, that doesn't mean it wasn't installed. 61 00:02:48,050 --> 00:02:50,810 It just means that we're not able to reference it. 62 00:02:50,810 --> 00:02:55,000 We're not able to execute the program simply by running my SQL. 63 00:02:55,010 --> 00:03:00,140 What we need to do is a little annoying if you don't have any experience with Terminal, but I'm going 64 00:03:00,140 --> 00:03:01,640 to give you the commands you need to run. 65 00:03:01,650 --> 00:03:08,180 Basically, we need to tell our terminal about the MySQL program, where to find it, and the way that 66 00:03:08,180 --> 00:03:12,000 we do that is by opening a particular file. 67 00:03:12,020 --> 00:03:22,010 Now type this carefully and also just copy and paste if you prefer tilde slash and then dot bash pro 68 00:03:22,030 --> 00:03:22,610 file. 69 00:03:22,820 --> 00:03:25,910 So this is a file that likely already exists on your machine. 70 00:03:25,910 --> 00:03:28,880 Now it's going to look different than what I have here, and that doesn't matter. 71 00:03:28,880 --> 00:03:29,720 It might be empty. 72 00:03:29,720 --> 00:03:34,820 And if it doesn't exist at all and you've got an error that's also OC, all you would do is run this 73 00:03:34,820 --> 00:03:39,380 command first and again I'll have these written out for you so you don't have to type them yourself. 74 00:03:39,380 --> 00:03:43,370 Touch this particular thing called the bash profile. 75 00:03:43,370 --> 00:03:46,760 It's a file that will make the file and then you can open it. 76 00:03:46,940 --> 00:03:48,620 So I already have one. 77 00:03:48,620 --> 00:03:53,390 I open it and all I'm going to do is put this very important line of code at the bottom. 78 00:03:54,080 --> 00:03:58,460 Export path equals the current path usr local MySQL bin. 79 00:03:58,490 --> 00:04:04,040 We're basically saying add in this thing called MySQL, we've already installed it and I'm going to 80 00:04:04,040 --> 00:04:08,540 save and close this file so I know this all feels a bit tedious. 81 00:04:08,540 --> 00:04:09,200 It is. 82 00:04:09,500 --> 00:04:11,270 Which is the reason. 83 00:04:11,510 --> 00:04:16,430 Initially when I made this course I didn't have students do this, but the tools that we used back then 84 00:04:16,430 --> 00:04:17,810 no longer exist. 85 00:04:17,810 --> 00:04:19,220 So I'm here redoing it. 86 00:04:19,970 --> 00:04:25,850 So now that I have that done, what I can do is open up a new terminal window. 87 00:04:25,850 --> 00:04:26,750 There we go. 88 00:04:26,750 --> 00:04:30,620 And I should be able to type my SQL and I get a different error. 89 00:04:30,620 --> 00:04:31,730 But this is a good error. 90 00:04:31,730 --> 00:04:37,400 This error says access denied for this user and that is a MySQL error. 91 00:04:37,400 --> 00:04:42,290 The error we got previously was just the terminal saying, I don't know what you're talking about with 92 00:04:42,290 --> 00:04:43,700 my SQL here. 93 00:04:43,700 --> 00:04:47,510 My SQL is saying, Yeah, you don't have the right password, I can't log you in. 94 00:04:47,750 --> 00:04:48,770 So that's good. 95 00:04:48,890 --> 00:04:55,070 And the truth is we're not going to be using my SQL on its own the way that we're going to start up. 96 00:04:55,070 --> 00:04:59,870 My SQL is exactly like this, my SQL dash, you root. 97 00:05:00,050 --> 00:05:04,850 This says we're logging in as the user that's with the you is root. 98 00:05:04,850 --> 00:05:09,650 And if you remember when we installed it a couple of moments ago, we also had to provide a password. 99 00:05:09,890 --> 00:05:14,870 So we add this dash P and then hit enter and then our prompt will change. 100 00:05:14,870 --> 00:05:19,760 And it's asking me now to type the password I set up for the root user. 101 00:05:19,760 --> 00:05:22,610 So whatever user I specified, we only have one user. 102 00:05:22,640 --> 00:05:27,110 It's kind of complicated when you're starting out, but remember we set up a password for the root user. 103 00:05:27,110 --> 00:05:28,130 You didn't have a choice. 104 00:05:28,130 --> 00:05:30,290 So type that password and hit enter. 105 00:05:31,060 --> 00:05:32,890 And hopefully it works. 106 00:05:32,890 --> 00:05:36,400 And if it does work, you'll see something like this a different prompt. 107 00:05:36,400 --> 00:05:40,660 It says MySQL here you can type things and get errors. 108 00:05:41,110 --> 00:05:42,610 Here's a MySQL error. 109 00:05:42,880 --> 00:05:46,360 We're not going to learn much in this video, but if you want to get out of here, type quit followed 110 00:05:46,360 --> 00:05:49,060 by a semicolon and then it just says bye. 111 00:05:49,570 --> 00:05:50,830 So one more time. 112 00:05:51,430 --> 00:05:56,830 My SQL on its own probably not going to work for you, but if we do dash you route, that's saying we're 113 00:05:56,830 --> 00:05:58,510 logging in as the root user. 114 00:05:58,540 --> 00:06:01,600 That's also not going to work because I didn't provide a password. 115 00:06:01,660 --> 00:06:07,360 But then the dash P at the end says, I'm going to provide you a password and then it asks me to enter 116 00:06:07,360 --> 00:06:10,630 the password immediately and I won't see what I'm typing. 117 00:06:10,630 --> 00:06:10,990 Right. 118 00:06:10,990 --> 00:06:13,240 That's the whole reason it's set up this way. 119 00:06:13,240 --> 00:06:17,830 Instead of having you provide your password like right here afterwards, anybody could look at that 120 00:06:17,830 --> 00:06:21,880 in your history, you would be typing your password in text as part of the command. 121 00:06:21,880 --> 00:06:27,700 So instead your cursor goes into this mystery mode and I didn't type my correct password, but I'll 122 00:06:27,700 --> 00:06:33,340 type it correctly and you can change this password, but you should just use the password you previously 123 00:06:33,340 --> 00:06:35,500 set up when we actually ran the installer. 124 00:06:35,800 --> 00:06:42,880 Okay, So that is the basic process now for when you're following along in this course, I would honestly 125 00:06:42,880 --> 00:06:50,410 just leave this open in a terminal window, have your MySQL prompt open here and you can run all the 126 00:06:50,410 --> 00:06:52,000 different commands I'm going to show you. 127 00:06:52,690 --> 00:06:53,890 You can log out, right? 128 00:06:53,890 --> 00:06:57,760 You can quit and then you'll just have to come back any time you're doing the course. 129 00:06:57,760 --> 00:07:04,630 And just remember the MySQL dash, you root dash P it's not a big deal, but if you're really jamming 130 00:07:04,630 --> 00:07:08,260 through the course, just leave it open and that should be pretty much it. 131 00:07:08,440 --> 00:07:08,930 Whew. 132 00:07:08,980 --> 00:07:10,120 Okay, we got that installed. 133 00:07:10,120 --> 00:07:10,990 I hope so. 134 00:07:10,990 --> 00:07:16,750 Now we're going to install the workbench, which just to remind you, my skill workbench is a graphical 135 00:07:16,750 --> 00:07:22,270 interface where we can write queries, execute them without having to work with the command line. 136 00:07:22,390 --> 00:07:26,290 So it looks I already have it installed, but it looks like this on Windows. 137 00:07:26,290 --> 00:07:29,380 This is the Windows version and here's the Mac version. 138 00:07:29,380 --> 00:07:30,430 I already showed you this, right? 139 00:07:30,430 --> 00:07:32,020 I write my query, I can run it. 140 00:07:32,020 --> 00:07:34,060 There's a lot more you can do as well. 141 00:07:34,060 --> 00:07:38,590 You can interact with databases, you can manage the databases here at different tables. 142 00:07:38,590 --> 00:07:39,820 You can create tables. 143 00:07:39,820 --> 00:07:45,010 We're going to learn about all this stuff, how to do it through SQL queries and SQL commands. 144 00:07:45,100 --> 00:07:49,750 Long story short, we want to install this and it is called my SQL Workbench. 145 00:07:49,750 --> 00:07:56,260 There's a link included along with this video to the download page, and then we'll click on the download 146 00:07:56,260 --> 00:07:56,880 button. 147 00:07:56,890 --> 00:08:04,600 Now if your particular architecture or operating or your version of Mac OS is not supported, I'll have 148 00:08:04,600 --> 00:08:07,600 a workaround for you in a moment, but I'm going to click download. 149 00:08:08,920 --> 00:08:10,300 We don't need to sign up or anything. 150 00:08:10,300 --> 00:08:14,220 Just start my download and then we'll drag that to applications. 151 00:08:14,230 --> 00:08:18,270 Wait for that to finish transferring or copying. 152 00:08:18,280 --> 00:08:22,060 I'll go to my applications and it should be in here and I'll open it up. 153 00:08:22,060 --> 00:08:22,840 There it is. 154 00:08:22,840 --> 00:08:26,290 And then once it opens, there's already a connection in place. 155 00:08:26,290 --> 00:08:32,470 I can click that and then I need to type in the root password that I set up when I just installed my 156 00:08:32,470 --> 00:08:35,409 SQL a couple of minutes ago and now I'm in. 157 00:08:35,590 --> 00:08:40,780 I made the font a little bit bigger and now we can try just to make sure that it's working. 158 00:08:40,780 --> 00:08:44,169 We'll do something silly like 99 plus one. 159 00:08:44,169 --> 00:08:47,980 So if we write, select 99 plus one, we'll learn all about select. 160 00:08:47,980 --> 00:08:52,240 That's like half the course and then a semicolon, and then I click the lightning bolt. 161 00:08:52,480 --> 00:08:54,040 We should see 100. 162 00:08:54,040 --> 00:08:57,580 And that's done through the my SQL Server behind the scenes. 163 00:08:57,580 --> 00:08:59,770 This is just the front end or the client. 164 00:09:00,070 --> 00:09:05,740 Okay, So we have the workbench installed and you can use this at any point in the course. 165 00:09:05,740 --> 00:09:10,270 All of the code, all of the queries I show you will work in the workbench. 166 00:09:10,270 --> 00:09:14,200 Now for some reason you are not able to install my SQL. 167 00:09:14,200 --> 00:09:20,080 Let's say it doesn't support your version of Mac OS or your particular architecture of your machine. 168 00:09:20,980 --> 00:09:25,510 There are many alternatives, many database clients that work with my SQL. 169 00:09:25,540 --> 00:09:30,010 The workbench is just one option, so DB gate is one that I can recommend. 170 00:09:30,010 --> 00:09:32,680 At least as of right now, these things change so quickly. 171 00:09:32,680 --> 00:09:33,160 Who knows? 172 00:09:33,160 --> 00:09:35,260 In a couple of months there might be something better. 173 00:09:35,260 --> 00:09:37,270 This one might just not even exist. 174 00:09:37,270 --> 00:09:39,490 But for now this is a good option. 175 00:09:39,490 --> 00:09:41,350 You can click download if you need it. 176 00:09:41,350 --> 00:09:41,590 Now. 177 00:09:41,590 --> 00:09:46,390 I don't really recommend going out of your way to install it unless my SQL workbench didn't work for 178 00:09:46,390 --> 00:09:46,810 you. 179 00:09:47,440 --> 00:09:53,890 So I'm going to open that up and then when you open it up, yours might look a tiny bit different because 180 00:09:53,890 --> 00:09:59,800 I change the font and the color, the background here, but basically it will look something like this 181 00:09:59,800 --> 00:10:06,130 where it is made to work with different connections, different databases, not just my SQL. 182 00:10:06,280 --> 00:10:13,510 So you will have to set up a connection, just close everything here that is a MySQL connection, not 183 00:10:13,510 --> 00:10:22,090 PostgreSQL not list, but my SQL and then we'll have it on local host 3306 is the default port, so 184 00:10:22,090 --> 00:10:27,070 just leave that there and the user that we're logging in in as is root. 185 00:10:27,070 --> 00:10:31,180 And that password here needs to be the root password that you set up for my SQL. 186 00:10:31,180 --> 00:10:35,710 And then you can test your connection here by clicking test if you see connected. 187 00:10:35,710 --> 00:10:37,690 I've already entered my password in the past. 188 00:10:37,960 --> 00:10:38,770 You're good to go. 189 00:10:38,770 --> 00:10:46,180 You can then click connect and you should momentarily see that it says connected and it says We're on 190 00:10:46,180 --> 00:10:47,080 local host. 191 00:10:47,080 --> 00:10:53,980 Now I can click the plus sign and write some basic code in here, like select 99 plus one, and then 192 00:10:53,980 --> 00:10:59,860 I can run it by going to execute using command, enter or right clicking execute. 193 00:11:00,070 --> 00:11:00,970 And there we are. 194 00:11:00,970 --> 00:11:03,070 We see 100 right there. 195 00:11:03,580 --> 00:11:05,590 Okay, So again, this is just an option. 196 00:11:05,590 --> 00:11:08,290 You can use it instead of the workbench if you prefer. 197 00:11:08,320 --> 00:11:14,110 I would stick with the workbench unless it doesn't work and then you can use DB gate. 198 00:11:14,140 --> 00:11:18,910 DB Gate is set up to work with many databases, so you just have to make sure you're using the MySQL 199 00:11:18,910 --> 00:11:23,260 connection type and that is it I believe, for installing on a mac. 200 00:11:23,980 --> 00:11:28,060 So here's the workbench, here's my terminal, here's DB gate. 201 00:11:28,090 --> 00:11:31,120 All of these are going to allow me to run the code in this course. 202 00:11:31,330 --> 00:11:33,340 Next up, we're going to start doing some of that. 203 00:11:33,340 --> 00:11:34,510 We're going to run some code.