1 00:00:00,420 --> 00:00:00,990 Warning. 2 00:00:01,320 --> 00:00:06,570 This video may contain extremely frustrating installation instructions and is for experienced developers 3 00:00:06,570 --> 00:00:07,200 only. 4 00:00:07,500 --> 00:00:11,880 It's advised that you install using Cloud nine to avoid needless pain and anger. 5 00:00:12,540 --> 00:00:15,990 Welcome to this video on installing MySQL on a mac. 6 00:00:16,079 --> 00:00:18,960 And again, I'll warn you, this can be painful. 7 00:00:18,960 --> 00:00:23,380 And this lecture and doing this, all these steps are 100% optional. 8 00:00:23,400 --> 00:00:28,590 In fact, if you don't have a good reason, if you're not sure if you should do this, then that means 9 00:00:28,590 --> 00:00:29,670 that you shouldn't do it. 10 00:00:29,670 --> 00:00:31,800 At least not until you get to the end of the course. 11 00:00:32,220 --> 00:00:37,020 Of course, if you're somebody who is an experienced developer and you know you want to get this running 12 00:00:37,020 --> 00:00:41,010 locally at the beginning on your Mac, then go ahead, follow these instructions. 13 00:00:41,010 --> 00:00:47,010 But I would definitely recommend that you go through the course for 99.9% of the people in this class, 14 00:00:47,040 --> 00:00:50,840 go through the course with cloud nine and then install this on your Mac at the end. 15 00:00:50,850 --> 00:00:52,800 It just makes everything so much easier. 16 00:00:53,280 --> 00:00:59,130 Okay, so if you're still here, though, the steps to actually install it are surprisingly simple. 17 00:00:59,520 --> 00:01:05,099 The problem is, once you install it, you run into issues depending on your developer environment, 18 00:01:05,430 --> 00:01:12,750 depending on things like if you're using Bash or Shell, if you have permissions issues and passwords 19 00:01:12,750 --> 00:01:15,840 and it just turns into a nightmare a little bit. 20 00:01:15,960 --> 00:01:17,120 Well, not just a little bit. 21 00:01:17,130 --> 00:01:17,780 A lot. 22 00:01:17,790 --> 00:01:21,060 So the first thing we need to do, like I said, is actually nice and easy. 23 00:01:21,060 --> 00:01:23,520 Just go to my SQL com. 24 00:01:25,410 --> 00:01:27,450 Go to the downloads tab. 25 00:01:28,440 --> 00:01:34,980 And what you'll see here are a bunch of the basically like the commercial services and MySQL enterprise 26 00:01:34,980 --> 00:01:36,610 software that is not free. 27 00:01:36,630 --> 00:01:40,980 We want the community section and then we want the first thing here. 28 00:01:40,980 --> 00:01:42,780 My SQL Community Server. 29 00:01:44,370 --> 00:01:49,560 Then at the very beginning, this is kind of just a blurb about it, some documentation and instructions. 30 00:01:49,560 --> 00:01:54,750 But if you keep scrolling down, you'll see the download links, so you'll need to select the one that 31 00:01:54,750 --> 00:02:02,520 corresponds to your Mac depending on how old your Mac is or how new it is, what version of Mac OS it's 32 00:02:02,520 --> 00:02:03,150 running. 33 00:02:03,150 --> 00:02:05,700 All of that you'll have to make a decision. 34 00:02:05,700 --> 00:02:08,460 But for me it's this first one here. 35 00:02:08,460 --> 00:02:14,760 So I'll click download and it looks like you have to type or you have to sign in or create an account. 36 00:02:14,760 --> 00:02:16,410 But that's not true. 37 00:02:16,710 --> 00:02:18,780 You scroll down and there's this link. 38 00:02:18,780 --> 00:02:19,260 No thanks. 39 00:02:19,260 --> 00:02:20,370 Just start my download. 40 00:02:20,400 --> 00:02:24,990 Of course, if you want to you can sign up, but most of you probably don't care. 41 00:02:24,990 --> 00:02:25,860 So just click. 42 00:02:25,860 --> 00:02:26,490 No thanks. 43 00:02:26,490 --> 00:02:32,070 Just start my download and I'll see you in just a second once I edit this download Time Out. 44 00:02:32,100 --> 00:02:36,270 All right now that's completed downloading so I'm just going to open it up. 45 00:02:36,910 --> 00:02:43,260 Might take a second to open, but once it does, you'll see a single file inside of this and we'll just 46 00:02:43,260 --> 00:02:47,120 double click, follow the steps, continue. 47 00:02:47,430 --> 00:02:49,320 Read every word of this. 48 00:02:49,350 --> 00:02:50,610 Of course I've already done it. 49 00:02:50,610 --> 00:02:53,550 So you know, I know everything it says. 50 00:02:54,660 --> 00:02:55,500 Click agree. 51 00:02:56,770 --> 00:03:01,270 Tells you 1.13 gigs space needed to make sure that you have that available. 52 00:03:01,660 --> 00:03:03,160 Then we'll click install. 53 00:03:03,640 --> 00:03:06,340 Then it will ask you for your password for your computer. 54 00:03:06,670 --> 00:03:10,570 Fortunately, I guess I can use my thumb or my finger. 55 00:03:11,110 --> 00:03:13,530 That way you don't have to watch me type my password. 56 00:03:13,540 --> 00:03:14,830 I don't have to edit that out. 57 00:03:15,310 --> 00:03:16,540 It's always a problem. 58 00:03:16,930 --> 00:03:18,700 I don't want people to see my passwords. 59 00:03:19,190 --> 00:03:21,580 Okay, so here's an important part. 60 00:03:21,580 --> 00:03:25,900 I mean, it's all important, but this in particular, it gives you a little pop up here. 61 00:03:25,940 --> 00:03:32,650 It says a temporary password is generated for root at local host and then it gives you this password. 62 00:03:32,830 --> 00:03:37,690 So I highly well, I don't highly recommend you need to copy this. 63 00:03:38,140 --> 00:03:43,010 Technically, if you forget it or you lose it, you can reset the root password. 64 00:03:43,030 --> 00:03:45,940 It's just another set of steps and complications. 65 00:03:45,940 --> 00:03:47,680 So copy this. 66 00:03:48,640 --> 00:03:49,330 Save it. 67 00:03:50,850 --> 00:03:53,540 Okay, we're now done installing it. 68 00:03:53,560 --> 00:03:54,910 We're going to move it to the trash. 69 00:03:55,240 --> 00:03:57,130 So we're done with the install. 70 00:03:57,130 --> 00:03:58,440 But that's the easy part. 71 00:03:58,450 --> 00:03:59,720 Just a couple of clicks. 72 00:03:59,740 --> 00:04:01,390 Now we need to do a couple of things. 73 00:04:01,390 --> 00:04:03,280 The first is start up the server. 74 00:04:03,430 --> 00:04:09,460 So to do that, we go to system preferences and it should be down here. 75 00:04:09,460 --> 00:04:12,880 There should be a new icon somewhere, at least depending on how you have your setup. 76 00:04:12,880 --> 00:04:15,540 For me, it's the bottom left, my SQL. 77 00:04:15,550 --> 00:04:21,370 I'll click on that and we should see my SQL Server status, you know, blah, blah, blah. 78 00:04:21,399 --> 00:04:24,250 It's the server instance is currently stopped. 79 00:04:24,940 --> 00:04:28,630 There's a button to click to start it which will start it. 80 00:04:28,780 --> 00:04:33,710 And then there's also this checkbox which I'll address now, depending on what you want. 81 00:04:33,730 --> 00:04:38,570 You can have my SQL Server start up every time you start your computer. 82 00:04:38,590 --> 00:04:39,910 I'm not going to do that. 83 00:04:39,910 --> 00:04:41,410 You have to type your password again. 84 00:04:41,800 --> 00:04:48,040 I have like six or seven database servers on here and I just don't want any of them to start up on this 85 00:04:48,040 --> 00:04:48,370 machine. 86 00:04:48,370 --> 00:04:50,650 At least this is not my developer machine. 87 00:04:50,650 --> 00:04:52,390 This is what I use for teaching. 88 00:04:53,020 --> 00:04:53,890 Totally up to you. 89 00:04:53,920 --> 00:04:55,510 Just depends on how you're using it. 90 00:04:55,510 --> 00:05:00,040 But if you're just learning my SQL now, it might actually be good to leave that on so you don't have 91 00:05:00,040 --> 00:05:02,170 to continually start it. 92 00:05:02,170 --> 00:05:04,270 But either way, it's not that hard to start. 93 00:05:04,270 --> 00:05:06,190 It's just a button here which will click now. 94 00:05:07,850 --> 00:05:08,840 And there we go. 95 00:05:09,410 --> 00:05:13,610 If you didn't click this or uncheck this, you may have to type your password when you click that the 96 00:05:13,610 --> 00:05:14,330 first time. 97 00:05:15,680 --> 00:05:19,910 So now what we have left to do is open up our terminal. 98 00:05:21,510 --> 00:05:23,190 And start interacting with this. 99 00:05:23,190 --> 00:05:25,440 So I'm going to bring the font size up a bit. 100 00:05:26,580 --> 00:05:29,820 And theoretically, you should be able to type my SQL. 101 00:05:31,090 --> 00:05:33,300 But this is where we start running into issues. 102 00:05:33,310 --> 00:05:35,290 So I'm getting this command not found. 103 00:05:35,290 --> 00:05:40,900 And if you get this again, this depends on how your Mac is set up and your developer environment and 104 00:05:40,990 --> 00:05:42,790 this is where it's annoying. 105 00:05:42,970 --> 00:05:45,520 But for me, I'm using something called Shell. 106 00:05:45,520 --> 00:05:46,690 I'm getting command not found. 107 00:05:46,690 --> 00:05:51,070 And that's because the my SQL Command is not it's not in my path. 108 00:05:51,370 --> 00:06:00,310 So what I need to do now, I'll open up my dot slash dot RC file. 109 00:06:02,780 --> 00:06:05,360 And I'll paste this line in here just so you can see it. 110 00:06:06,440 --> 00:06:10,430 I'll include this in the instructions for this lecture. 111 00:06:11,000 --> 00:06:13,100 You can find this on anywhere online. 112 00:06:13,100 --> 00:06:17,760 It's very common error when people type my SQL and you get command not found. 113 00:06:17,780 --> 00:06:22,250 In fact, if we just did that right now, I went to Google. 114 00:06:23,800 --> 00:06:30,760 You can see, depending on what version of OSX you're running, there's all sorts of replies that are 115 00:06:30,760 --> 00:06:32,440 basically exactly what I just did. 116 00:06:32,560 --> 00:06:34,480 In fact, that's where I got the line originally. 117 00:06:34,510 --> 00:06:38,770 It just depends on if you're using batch and if you are, then you can use a line like this. 118 00:06:38,770 --> 00:06:42,550 But essentially there's all these possibilities depending on your environment. 119 00:06:42,760 --> 00:06:48,340 So I can't cover all of them here, but find the correct command for you to run. 120 00:06:48,340 --> 00:06:50,680 And that's only if you're getting command not found. 121 00:06:50,920 --> 00:06:55,150 All right, so we need to save this file. 122 00:06:56,170 --> 00:06:58,120 Close it down, go back to terminal. 123 00:06:58,600 --> 00:07:01,630 Then the next thing, I'm just going to close the window and reopen it. 124 00:07:02,170 --> 00:07:05,110 Or you can quit terminal or you can source your profile. 125 00:07:05,680 --> 00:07:09,280 Now, what I need to do is try my SQL again. 126 00:07:10,320 --> 00:07:10,800 Okay. 127 00:07:10,800 --> 00:07:12,300 So now we have a different problem. 128 00:07:12,300 --> 00:07:14,790 And this is a it's not a great problem, but this is a problem. 129 00:07:14,790 --> 00:07:19,770 We should have access denied for user cult steal at local host using password. 130 00:07:19,770 --> 00:07:25,590 No, the problem is if you remember well, first of all, this means that my SQL, the command is found, 131 00:07:25,590 --> 00:07:27,690 it's running, but we're getting a result now. 132 00:07:27,690 --> 00:07:31,710 And the problem is that I'm trying to start my SQL and I don't have permission. 133 00:07:31,710 --> 00:07:34,260 I need to log in as the root user. 134 00:07:34,380 --> 00:07:36,240 And remember, we saved that password. 135 00:07:36,240 --> 00:07:39,600 So I went and copied that password that we were told to save. 136 00:07:39,600 --> 00:07:40,890 It's on my clipboard now. 137 00:07:41,340 --> 00:07:43,860 I can paste it, but that won't do anything. 138 00:07:44,220 --> 00:07:53,010 What we need to do is run my SQL, dash you space root dash P and hit enter and it should prompt you 139 00:07:53,010 --> 00:07:53,970 for the password. 140 00:07:55,020 --> 00:07:58,170 You can paste that in and we're in. 141 00:07:58,530 --> 00:07:59,520 All right. 142 00:07:59,520 --> 00:08:02,820 So if you get this far, congratulations. 143 00:08:02,820 --> 00:08:03,900 Everything's working. 144 00:08:04,410 --> 00:08:08,220 If you didn't get to this point, it's likely because of a couple of reasons. 145 00:08:08,220 --> 00:08:14,160 One is that you're still getting that command not found issue that one is relatively easy to fix. 146 00:08:14,160 --> 00:08:19,890 The problem is you have to be comfortable using your command line and opening up hidden files like batch 147 00:08:19,890 --> 00:08:22,380 profile or your zip file. 148 00:08:22,890 --> 00:08:28,380 The other problem you could run into is this permissions thing, and if you didn't save that password 149 00:08:28,380 --> 00:08:34,289 that I told you you should save, but if you didn't or you close the window accidentally, you can reset 150 00:08:34,289 --> 00:08:35,039 the root password. 151 00:08:35,039 --> 00:08:38,370 All you need to do is go online and Google it. 152 00:08:38,370 --> 00:08:40,380 There's a couple of posts online about it. 153 00:08:40,500 --> 00:08:48,240 Basically what you do is you run my SQL dash, you space root, and there's something called Flush Privileges 154 00:08:48,330 --> 00:08:52,110 Command and you can update your password with a new password. 155 00:08:52,410 --> 00:08:56,820 There's a couple of things you can do like that, basically, rather than me making a video for every 156 00:08:56,820 --> 00:08:57,840 possibility. 157 00:08:58,500 --> 00:09:00,660 It's much better if you just find it out online. 158 00:09:00,660 --> 00:09:04,020 And this is why I recommended that you use cloud nine. 159 00:09:04,470 --> 00:09:05,730 I promise they're not paying me. 160 00:09:05,730 --> 00:09:09,390 It's just that this is difficult, especially in an online setting. 161 00:09:09,690 --> 00:09:15,000 Okay, so you might think we could start running some MySQL code, like if you tried. 162 00:09:15,450 --> 00:09:21,750 Here's something we haven't actually seen yet, but if you tried this or actually, how about show databases? 163 00:09:21,750 --> 00:09:23,760 So this would show us a list of databases. 164 00:09:24,030 --> 00:09:27,510 And if there are no databases, it should still show us something. 165 00:09:27,510 --> 00:09:29,460 But instead we get this. 166 00:09:29,460 --> 00:09:33,570 You must reset your password using all true user statement before executing this statement. 167 00:09:34,050 --> 00:09:40,710 Okay, so our final hurdle here, what we need to do is I have a command that I just had on my clipboard, 168 00:09:40,710 --> 00:09:48,930 but it looks like this alter user in quotes, root at and then in quotes local host identified by. 169 00:09:49,110 --> 00:09:55,350 And then all you need to do is provide a password here in quotes that you would like to use for the 170 00:09:55,350 --> 00:10:00,000 root user for your MySQL install or for this server instance. 171 00:10:00,000 --> 00:10:03,990 And so just type something, I'm just going to make mine password. 172 00:10:04,680 --> 00:10:05,670 There we go. 173 00:10:05,760 --> 00:10:06,750 And hit enter. 174 00:10:07,410 --> 00:10:08,700 Oh, with a semicolon. 175 00:10:09,490 --> 00:10:13,360 Now if we get the query, okay, things should be working. 176 00:10:13,360 --> 00:10:17,860 If I try my show database command, this time we're in. 177 00:10:18,010 --> 00:10:19,870 I don't get this permissions problem. 178 00:10:20,520 --> 00:10:20,830 Phew. 179 00:10:21,670 --> 00:10:22,450 It worked out. 180 00:10:22,960 --> 00:10:24,370 So, again, that command. 181 00:10:24,370 --> 00:10:29,020 I'll also include in the instructions if you need to do that, it's just alter user route. 182 00:10:29,050 --> 00:10:31,750 That local host identified by password. 183 00:10:32,070 --> 00:10:39,550 OC So then the last thing is if you want to close out, by the way, it's Command D which we'll be covering 184 00:10:39,550 --> 00:10:43,720 all this if you're going through the course of the very first time and this is how you decide to start. 185 00:10:43,960 --> 00:10:48,850 We'll actually go over these commands in the next section when we install everything, once we have 186 00:10:48,850 --> 00:10:54,040 everything installed and we start talking about MySQL, but we need to be able to verify the install. 187 00:10:54,040 --> 00:10:55,450 So there's a couple of commands. 188 00:10:56,320 --> 00:10:59,800 So now if I wanted to try logging in again, I shut it down. 189 00:11:00,220 --> 00:11:08,620 It's my SQL dash you root dash P and then we'll ask me for my password, which I changed to password 190 00:11:08,920 --> 00:11:14,740 type that you won't actually see it, but if you type it correctly, you're in OC. 191 00:11:15,220 --> 00:11:19,340 So that is our journey to installing MySQL on a mac. 192 00:11:19,360 --> 00:11:20,260 Great time. 193 00:11:20,650 --> 00:11:25,450 Hopefully if you got to this point, you made it through and everything worked out. 194 00:11:25,750 --> 00:11:30,820 If not, if you're just starting this course off, I still highly recommend that you switch to using 195 00:11:30,820 --> 00:11:31,330 cloud nine. 196 00:11:31,360 --> 00:11:35,440 Avoid all of these issues and then come back to this when you feel more confident. 197 00:11:35,470 --> 00:11:39,490 Otherwise, if you absolutely have to use a mac, we'll try our best to help you out. 198 00:11:39,730 --> 00:11:41,260 Anyways, moving on.