Placeholder Image

字幕列表 影片播放

  • creating these classes requires equipment and service.

  • Is that cost money?

  • If you appreciate this education, please think about going to Eli the computer guy dot com and offering a one time or monthly recurring donation.

  • Welcome back.

  • So today's class I'm going to teach you how to be able to create databases and be able to delete data bases on you're my sequel database server.

  • I'm also going to show you how to see what privileges your particular user account has simply to verify that you have the permission to be able to delete or be able to create databases on the server.

  • That is an important thing to it.

  • To remember again when you're thinking about the technology world and we're thinking about security is that security comes in multiple different levels, right?

  • So basically, if you're talking about the network you have secured in the network with things like firewalls to prevent hackers from coming in on certain ports on the operating system itself, you have file and folder permission.

  • That's saying what user accounts can d'oh but within my sequel, there are also user accounts there, and those user accounts have asserted permission.

  • So things such as being able to create a database is being able to delete databases being able to earn insert rose and certain records, that type of thing, those air, all different permissions that you can either assign to users or be able to deny to users.

  • So I'm going to show you the show of Grant's command just to verify if you're going in and you're trying to create a database or delete a database and you run into some kind of access denied issue, Uh, just to be able to do the show grants and see if you have the permissions to do what you think you're supposed todo.

  • So today I'm going to show you how to create and delete the databases on also how to look at what your privileges are.

  • So, as I said in the previous video, and I'm sure I will say in many more videos in this Siri's a warning.

  • A warning.

  • Will Robinson.

  • A warning, A warning.

  • So this whole my sequel syriza probably going to do a lot of warnings just to explain to you folks, especially any of the old timers out there maybe trying to teach things and something that may seem like a bit of a convoluted way, but I'm actually trying to teach you this and what I think will be the simplest way for people to learn.

  • S so when we go in today and we actually start dealing with the databases, we're gonna create a database to leave the database and show grants were going to be a long and simply using the pseudo command for my Sequels are going to sue do up my sequel and that will drop us in as literally the root level user for the my sequel server.

  • I'm doing that because I have not yet shown you how to create user accounts within my sequel.

  • And I don't actually want to do that class until a few classes down the road.

  • Right?

  • So when you have user accounts, you also have privileges, basically security permissions within my sequel.

  • And so what?

  • I want to dio I want to show you how to create a database that I want to show you create tables.

  • Then I want you to show you how to insert records.

  • Then what I want to do is then go and show you how to create a user account on, then be able to give that user account specific permissions.

  • And then with those permissions, you can go in and see what you're able to or not be able to d'oh.

  • So basically, today, when I'm gonna be showing you in, this is how to go in again using pseudo my sequel that will drop us in at the root level for my sequel That will allow us to create a database that allows to delete a database allows to do this show grants command.

  • I will actually also create a user account just to kind of give you a bit of an example there.

  • But we're not actually going to be learning how to create users accounts in this class.

  • I'm just going to use it as an example.

  • So if you get a little bit confused like we're sitting here going, wait a minute.

  • Why he keeps longing and under suit, my sequel instead of my sequel hyphen, space hyphen, U space user account space hyphen P is how you normally should do it.

  • The reason I'm doing it is just again.

  • It's that whole.

  • When you're taking technology, it's I'm trying to, you know, there's there's so many subjects you have to kind of try to teach at once.

  • And so trying to figure out how to position all of those things could be a bit complicated.

  • So also, if you're following along with this particular class and you have a user account that has all privileges for a database server, by all means log in using that particular account again.

  • Bye Sequel.

  • Space hyphen, you space user account space hyphen Pee on that will look you in.

  • That's the normal way too long again.

  • But for the people following along at home, they just created their lab set up.

  • We're going to be using Studio my sequel again just because it's, you know, the simplest way of trying to explain all this stuff, the new people.

  • So here we are at my my sequel, a lab server that I've created S so I figure that going through a bunch of desktop 18.4 again the desktop that uses the graphical user interface that will be the best way to go for these particular classes.

  • Again, I have this running in a virtual machine on virtual box on my Mac book Pro But if you install this directly onto bare metal, that would be fine, too, so that lets go down, click on the little show applications.

  • Then you go up into the search for new type terminal, and then you click on terminal and you get your fancy little terminal here.

  • So from this point, what we're going to need to do is we're going to need to log into my sequel.

  • And so we're gonna do is sue my sequel right again.

  • If you have a normal user account already, what you do is you do my C cool space hyphen you space account name, space hyphen P.

  • And that is how you would normally log into my sequel.

  • But that will be for the future.

  • That will be for the future right now.

  • This is how we're going to log in.

  • You gonna ask me for the password?

  • Supersecret.

  • 123456 Password, Inner.

  • And there you go.

  • I do have to say one of the nice things about running my sequel on a local machine versus learning this stuff up on some kind of cloud hosting provider is that you could do things like have really crappy security.

  • Because when I'm done with this class and literally shut off the virtual machine And therefore, it is not a security vulnerability for my network or for my systems.

  • Right?

  • So if I If I deploy my sequel up onto a cloud server, I use really crappy path user names, really crappy passwords.

  • I connect some PHP scripts to a right.

  • A hacker might be able to find that and be able to have a lot of fun at your expense.

  • One of the nice things about spinning us up locally again.

  • As soon as I am finished with this class or my lad, Whatever I'm doing, I literally turn off the virtual machine, and there is no longer a vulnerability there.

  • Uh, so just one of those things to be thinking about now, the first thing that we're going to do is we're actually use a command.

  • A show data basis, s O show databases.

  • This will show us the databases that already exists on this particular my sequel server.

  • So you type in show databases on Michael.

  • Oh, a semi colon.

  • Never forget, said Michael.

  • And then you hit her on.

  • So here we can see what databases?

  • We currently have databases.

  • We have something called the information scheme up.

  • My sequel database.

  • This actually has all of my sequel user accounts, configurations, That's everything.

  • More or less.

  • Or unless these air the databases you don't screw with, you know, screw it.

  • There you go in and you see it.

  • Other database for the other databases.

  • Don't muck with these once you secure days.

  • And it's kind of like screwing with the rightest room again.

  • If you If you're dealing with what knows PCs and you go and you start screwing around with registry, you know, you might crash your system, that that's how these are.

  • Don't don't screw with those unless you you know what the hell you're doing s So the first thing that we're going to do is we're going to simply create a database.

  • What is oh so complicated?

  • So all we do is we do create that was simply, say, data base, and then we do a space, and then whatever our database it named Issa, we'll simply to test It's a test d b on.

  • Then I will have to do a semi colon because you always got to do the semi colon.

  • Then you hit her query.

  • Okay.

  • Hello, Uh, one row affected.

  • Blase, blase, blase.

  • If we go then in and we simply say, showdown a bases again.

  • Semi colon hit.

  • Enter.

  • But you can now see, we have the databases information scheme of my sequel performance game assists and test D B s.

  • So now we have that database.

  • So if we wanted to start adding tables and within the tables, we start start adding records, that type of thing, we would now do that within the test D.

  • B s.

  • So, basically, if you're gonna start using testy, be simply you do use and then test the B and then do semi colon and then that would drop you in to test d.

  • B itself.

  • And so really, that is all there is for creating a database.

  • That is, that is literally.

  • Yet there's no doesn't ask you if you want to do it.

  • You don't have to do any additional verifications.

  • You have simply created it.

  • So now if you want to be able to delete a database, basically all you do is the drop commands you to drop space base space and them test the be semicolon.

  • Of course, because there's always a semi colon hit Enter.

  • Okay, it's done.

  • Now, this is where you gotta be.

  • Careful, boys and girls, this is gonna be Did you notice it didn't ask you if you wanted to do it.

  • It did it.

  • Didn't verify if you want to do it, he didn't say, Hey, have you done a backup of your entire CR M?

  • It just did it.

  • So do you remember?

  • My sequel is a backend for scripting language is for again, like PHP or the other.

  • Scripting language is out there, and so they don't want tohave to put Acknowledgments in there, because then you'd actually have to script for right?

  • You just want to go to write a script that will don't put stuff in, pull stuff out, create databases, delete databases, that type of thing.

  • And so one of the issues you can run into is when you're coming in and you're doing manual maintenance.

  • If you fat finger something if you fat finger something, you could wipe out the entire back in database for your C.

  • R M solution literally as quick as 0.0 seconds.

  • So again.

  • Do you be very careful.

  • And again, we're talking about security and things.

  • Make sure you always have backups.

  • Because if you don't, you're going to have a lot of problems.

  • And so that is literally all you have to do in order to create a database and believe in database.

  • Right.

  • So we go when you do show that a basis again.

  • Again.

  • Semicolon hit, Enter.

  • You see, we get back to the standard databases that we had before.

  • Okay, so now I want to show you the show grants command.

  • So this is going to show you the privileges for the current user that is long rightto again to make sure that you are supposed to have the ability to be able to do things like create databases and elite databases so that what we're gonna do is we're simply going to type in show grants, and that is the entire command Semi colon, of course.

  • And what this is going to do is this is going to show that permissions the privileges, the grants for worthy currently logged and user I'm currently long in as, ah, local, a route at local host, and what we can see here is I'm a granite all privileges So I have all privileges all permissions on And then you see this started out star here Basically, we're looking at start of star As faras naming commissions go, The first star is for the database dot The second star is for the table.

  • So yesterday, when we were dealing with the user table and the my sequel of database, if we wanted to be able to reference that we would do my sequel dot period user and so that would be the user table into my secret database.

  • So we're saying, here is grant all privileges on star all databases dot all tables too route at local host.

  • And then it also has the with grant options, basically, with his means, as I am able to then give grant privileges to other user accounts.

  • So this shows you basically what permissions your current user hands.

  • So if you log in, you go to create a database unit to drop a database and for some reason you're not able to do it.

  • You get access denied against the new show grants and you will see what privileges what grants you actually have So with that, what we're gonna do now is just a little bit of extra credit.

  • Do not feel like you have to take any notes or anything.

  • We're going to talk about this kind of stuff, Mawr.

  • In the future, we'll have a specific class on creating users and all that kind of thing in future.

  • But it just kind of want to give you an overview of this show grants thing now, so that the first thing that I'm going to do is I'm going to create the database again.

  • So created database, and we're just going to recreate test D B semi colon.

  • Okay, one row affected.

  • We go back to showed at a base is okay, so we can now see that we've got the normal default, and then we have the test data base there.

  • The next thing they're gonna do is clear the screen s o.

  • I like clearing the screen in order to teach you folks.

  • How this is done.

  • Makes life a little bit easier for me on this particular computer.

  • If I type control l that will clear the screen for me, uh, for you on your particular system.

  • You may just have to do a bit of a Google search, but try and control l at first, try control element from their new ghouls or you need to clear the screen.

  • So now that we have the test database, we're going to create a user being give that user some privileges so that we can then use the show grants command to see what privileges that particular user has again, do not feel like you have to take any notes at home.

  • So we're gonna do is we're going to create user.

  • And again, one of things you're gonna start noticing is that they're similar syntax for everything within my people.

  • Again, any application that you're going to use the technology world.

  • There's There's a similar syntax throughout the entire application.

  • So within my sequel, create obviously creates databases, creates tables, creates users.

  • Drop is what you use to delete users, the lead databases, the league tables s So that's just one thing just to keep in mind.

  • If you're like, oh, how do I delete something?

  • Just remember, you almost always used to drop.

  • Now that's what we're going to use.

  • Create user.

  • Uh, we're gonna create a user called Tim.

  • So single quotation Mark Tin Close.

  • Single quotation mark identified.

  • Sure, I spell that right.

  • By So basically what they're saying with a password of 123456 Right?

  • So again, don't don't worry about taking notes.

  • Will do all of this later, but we're creating a user Single quotation marks, Tim closing quotation marks identified by this says, and with a password of single quotation Mark.

  • 123456 Close, single quotation mark and then semi colon.

  • And then we're going hit.

  • Enter and then we see query.

  • Okay, zero rose affected in 000 seconds.

  • That's all I had to do to create the user account.

  • And now what we're going to do is we're going to give that user account tim permission.

  • So we're going to give them him that permission to be able to insert on the test data base.

  • Don't worry about all this again.

  • We'll talk about this later.

  • I just want to have to show this to you so we can use that show grants thing in a second.

  • Eso we're going to granted the insert permission basically be able insert records into a table spends we're going to insert on test the test BBB dot star here.

  • So grant the insert permission on the test data base for dot for all tables.

  • Right.

  • Um and they were going to say to space, too, and then we're going to say two Tim on that.

  • We're going to see Michael.

  • So this is going to grant those permissions to Tim.

  • And then we had query.

  • Okay.

  • Zero rose affected, blah, blah, blah, blah, blah.

  • So now one of things we can do is we can now see what permissions another user has within my sequel, right?

  • So if I do show grants right now, when I do semi colon, that is going to show me what privileges I have.

  • So if you do show grants and then we d'oh for and then whatever the user name is, we're going to say show grants for Tim and then we do soul that semi colon we hit Enter, we now see what privileges?

  • What grants?

  • Tim has S o tim.

  • This tim account has the grant usage.

  • So basically it's able to use C so grant all privileges.

  • So the root account has all privileges on star not star.

  • Basically, for Tim, it has the usage.

  • Permission on Stardust are so everything.

  • And then it has the insert on test d B A star.

  • Right?

  • So that is the permissions that Tim actually has.

  • So from here, what we could do is we can exit out and we can actually log Innes Tim and then try to create a table and see what happens.

  • So that little type exits is Well, log us out.

  • So we're now longed out of of my sequel, and we will now log back in so we clear the screen a real quick.

  • Okay, so now we're up here.

  • And so the normal way, the normal way you will long into my sequel is my sequel Space hyphen U with that new user account.

  • Tim, Space hyphen P.

  • So this is the normal way that you would lock it, and then you enter asking for the password, and then you hit and Yeah.

  • Hey, you're along down.

  • Okay.

  • So what if I want to create a database, uh, like new d B.

  • Right.

  • And then I do cynical and so create database new DVDs.

  • I'm simply created a database just like it was before Now enter.

  • Ooh!

  • Error.

  • Error.

  • Will Robinson access denied for 10 to data Vance knew d B.

  • And I'm like, huh?

  • Why is that?

  • So I could do show grants like I did before, Semi colon.

  • And then if you owe, I only have the insert privilege on test D B for all all the tables on test TV.

  • I don't have the ability to create a database within this particular particular my sequel server.

  • And so I need to go and ask the administrator or figure something else out.

  • If I have to be to create a database s O.

  • That is a just a basic explanation there of how you can create anatomy is you're gonna drop it at a base, and then you can see the privileges to see if you have the right to either create or deleted data base within my sequel.

  • And so there you go.

  • Now you know how to create a database deleted data base and be able to see privileges.

  • Now you probably don't realize is at home because hopefully I did those jump cuts pretty well.

  • But I do have to say there are a lot of guts in that video.

  • One of things that you run into in the mice evil world again.

  • Kind of like with Lennox or anything else is if you don't type and everything perfectly the command doesn't work, so don't get frustrated.

  • Don't get frustrated.

  • You're home.

  • You're trying to type in the commands and you keep screwing up the commands, even even us professionals due to the difference between me and you is I get to jump, cut out all the errors you're saying they're forced to see yours.

  • Eso again.

  • That's an important thing to realize again with my sequel again.

  • Really, With any kind of technology you're gonna be using at a command line is basically if you type in the words perfectly, the syntax perfectly everything will go great if you fat finger the syntax, you can have problems.

  • So let's create that Tim account again identified.

  • I don't know.

  • I just kept screwing up, identified identifying space by Yeah, I fat finger that, like, three or four times, we just jump cut it that kind of thing out, eh?

  • So, again, this is one of those things just to really realize you're sitting there and you're typing in the commands to my sequel.

  • Just, you know, again, take take a second look, make sure you're typing and the right command.

  • And then if it errors out, go back and redo it.

  • Though The one thing that I will warn you about, though.

  • And you really do have to be careful.

  • That is, when you're doing things like deleting data bases, you hit, enter, and the database is gone.

  • And now I make that joke about deleting the C R M database and you're sitting there like, yeah, you know, some company would like, I don't know, maybe 1,000,000 customers or whatever.

  • That would be a bad thing.

  • I actually had a buddy of mine.

  • I actually had a buddy of mine.

  • He really did do that Really did do that.

  • She was working about 100 hours.

  • One of the reasons why you don't work 100 hour weeks.

  • I know it.

  • I know it sounds really cool.

  • All these people like, yeah, I work 100 hour weeks don't work 100 hour weeks.

  • She had been working like her 2nd 100 hour week because they've been doing this massive migration.

  • No joke, no joke.

  • What happened was.

  • Now, the old database system is not really a server.

  • Percent was the old database system.

  • They're migrating to the new database system.

  • Oh, they had this naming convention.

  • They had a naming convention.

  • Right?

  • So basically what happened was, uh uh They migrated all the data over.

  • They spun up the new server making sure everything's working, right.

  • And then the idea is basically you.

  • Then you think kill the old server, you delete the information, the whole nine yards.

  • So that's on a security vulnerability?

  • Um, yeah, yeah.

  • Uh, she was sitting there.

  • The command problems?

  • Yeah, she says she still she still remembers doing it because that was a funny but the funny part.

  • She said the worst part about it.

  • Waas Woz.

  • She went to delete She was supposed to delete the old database.

  • Obviously not new database.

  • For some reason, she literally type in to delete the new database because her brain was just foggy.

  • She messed up.

  • She messed up.

  • Like when she timed in the command.

  • She fat fingered the command.

  • And so she actually tried to delete the new database, but failed because he fat finger the command.

  • He then looked at what she had done, fixed the command and then wiped out the brand new database.

  • Sir, that's not a joke when we're talking about again, we're not talking about 1000 1000 customers.

  • They had millions of customers.

  • She will make it out the C R M.

  • For a pretty sizable company, they will able they were able to recover from a backup.

  • But when you were kind of rain from that size of a backup, and it took about two days, basically imagine the C R M solution for a company with millions and millions and millions of customers going bye bye for a couple of days.

  • That was a bad thing.

  • And so again, when I when I talk about how easy it is to do something like to lead a database and it's like, Oh, uh, that's not really hot Oh, there's nothing.

  • So sad is watching a woman who's worked on 100 hours for a couple of a couple of weeks in a row, and then she has a meltdown because she wiped out the entire database, and then and then it's also funny.

  • It's really funny.

  • What's amusing is to then see a manager.

  • You see the manager who's sitting there and he really wants to scream at her.

  • You really want to say, What the hell were you thinking?

  • But at the same time, this woman is again were over 100 hours for a couple weeks in a row.

  • So if he pushes too hard, she might just completely melt.

  • Walked out the door.

  • And so you get into some Maria, we're in a managerial supervisor like dynamics there and again, Really, the lesson here.

  • The real lesson here is don't work 100 hours a week.

  • If you are in the technology of profession and you're actually doing command line stuff, don't get me wrong.

  • If you're ranking servers.

  • If you're ranking servers, work 100 hours if you want to.

  • If you're running cable, be careful.

  • Work 100 hours if you want to.

  • If you're typing commands in at the command line, do no work 100 hour weeks.

  • You start knowing stupid after 50 or 60 hours, and then you could do things like white database for millions and millions of customers.

  • So anyways, do be careful with that.

  • And so that's again.

  • This is basically a little bit getting and starting to get your feet wet with an actual of my sequel database server as we go on a little teacher, have you more things again with the whole user account thing right now having you along in as a pseudo my sequel.

  • I'm simply doing this because I'm tryingto figure out the best way to actually be able to teach you these steps without Can you confused at the same time?

  • So I'm going to show you how to create the user accounts we're gonna show you.

  • How do these permissions after I've shown you that the how to create the database and the tables will be able to insert records at that point?

  • Then I'll show you how to create user accounts on, and I think it'll be a little bit easier.

  • Everything will come into place a little bit better than create a user accounts in the beginning.

  • I think it's my style teacher.

  • Yeah, we'll see how it works out.

  • So anyways, as always, I enjoyed at, uh, taking this quest and look forward to the next one.

  • Apparently, the type of content you just saw is not what Susan W.

  • Wants for the future of YouTube.

  • This means that recommendations by YouTube to this channel have dropped massively, and views are becoming a comically small I hate to ask.

  • I used to say I would never ask, but if you could subscribe like common and most importantly, share the videos that you appreciate, that may help slow the death of this channel.

  • Do you remember that if anything at all happens to this channel, you can go to Eli, the computer guy dot com, to view the content and access information not available on YouTube.

creating these classes requires equipment and service.

字幕與單字

單字即點即查 點擊單字可以查詢單字解釋

B1 中級

MySQL - 創建、刪除數據庫和顯示授權(創建數據庫、刪除數據庫、顯示授權)。 (MySQL - Create, Delete Database and Show Grants (Create Database, Drop Database, Show Grants))

  • 12 1
    林宜悉 發佈於 2021 年 01 月 14 日
影片單字