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.