I will call you back again to another video lecture in MySQL.
And in this video lecture, I'll go ahead and teach you how to create your own database.
All right.
Now in the previous lecture we are able to set up our MySQL workbench and we have not done anything.
So going over here and go over to schemas move over here and click on schemas.
And down here or up here you can actually see our system database.
If you open up this you can see tables views stored procedures and functions.
Yes you can actually use this system database.
But we're not going to use that.
We're going to create our own database from scratch.
So in order to create our own database and database we create will actually appear in here.
So go ahead and say create.
Now if how to create you can actually use the lowercase because MySQL is not case sensitive.
So you can actually go ahead and see.
Great.
And I can actually also go in and say create.
You can see that each of them gives me a blue background showing that it is correct.
All right.
So I want to maintain the upper case.
And that is what I want to use throughout this course.
So I'm going to say create a data base.
And then I'm going to give the name of the database.
So for starting of this I'm going to say my DB though I'm going to change this later.
But for now I want us to move ahead and create this workforce database.
And then we can also create another database in this lecture.
Now let's go ahead and move over to this point.
We can see execute selected partial of the scripts or everything.
Go ahead and hit on these.
And down here you can see we have create database successful.
You can see the green tick right here.
And uh over here under the schema we can see the default database, which is a system database right
in here.
Now go up here.
And what you're seeing is system database.
You cannot see the database you created.
The reason is because you have not refreshed your database.
So anytime you create a database you go over here and click on this to refresh it.
Right now I have my DB and I can see tables, views, stored procedures, functions, everything just
like the system database.
So now I hope that is cool.
And you can see my schema still says that I'm using system database, which is not really what I want.
I want to make my own database as a default database.
How can I be able to do that?
For me to do that I'll go right here, click on this and I can set this as default.
But right now it's still not the default database.
The reason is because when you click on this you can see no object selected.
And the database I selected, which is my schema, my DB.
It is not actually in use.
The reason is because I have not set this database to be in use at the moment.
So if I want this database to be in use, I'll go ahead and click this.
And I'm going to say use my DB semicolon at the end.
Then I'll go over here and execute this as usual.
Now go ahead and click on this.
And now you can see that my DB has a bold black color change that I'm actually using my DB right now.
And down here you can see use my DB in green tick change that.
This query was executed successfully.
And now my db is what I'm using as a default schema.
All right.
Oh that is cool.
Now let's go ahead and show you how to drop this database in case you don't want to use this database.
The best way to do that is to go ahead and remove this.
And I'm going to say drop database and then give the name of the database you want to drop.
And go ahead and say my DB and never semicolon at the end of this.
Now let's go ahead and execute this query now.
Go ahead and hit on this.
And you can see drop database and another schema no object selected.
And over here under schemas I have only the system database right in here.
So I hope that is cool.
Wow that is good.
Now I have dropped my DB and you have learned how to create, how to use and how to drop your DB.
I hope that is fantastic.
Now let's go ahead and create our own database which we are going to use in this course.
So I'll go ahead and create a new database and we'll go ahead and say create database.
And I'm going to give the name of my database to be my school.
And at the end, because that is the database I want us to use for the purpose of this course.
Go ahead and hit on execute this query.
And I have create database MySQL already there.
Now I go ahead and I use my school.
I'll go ahead and say go ahead.
And uh.
use my school and go ahead and execute this query.
And I have my SQL right here and over here I'm gonna have a fresh TS, I have my SQL corrected and I
have my school also selected.
And that is the schema we are using right now.
So that is cool.
And uh, what if I want to alter my database.
You know, I created this database and drop this database as well.
So when I created the database I dropped it.
What I want to love this database to be grid only, and that you cannot be able to modify or drop the
database.
So how can I be able to do that.
So don't drop my database.
Now I'll go over here and delete this.
And I'm going to write a query.
And I'm going to say this to be alter database.
All right.
So order automata based MySQL.
And then you go ahead and set this to be read only.
So read only and let let this be equal to one.
I put a semicolon at the end.
So if I go ahead and execute this down here you can see our database MySQL read only equal to one.
And that is successful.
Now let's go ahead and drop this database and know if that will actually drop.
Go ahead and remove this.
And I'm going to say drop database.
And the name of my database is my school.
And then put semicolon at the end.
And let's go ahead and hit on this.
And you can see drop database MySQL error schema MySQL is in read only mode.
All right.
So at this moment you can be able to alter my database because I've set my database to be read only.
And therefore you cannot be able to alter these.
So that is cool.
Now if I want to be able to open it again so I can alter my database, I'll go back and I'm going to
say alter Data base, and I'll go ahead and give the name of the database to be MySQL, and I'll change
that to be read only and let it be equal to zero and a semicolon at the end.
And then go ahead and execute this.
And I have other database.
MySQL read only equal to zero.
And that is what I have right now.
So now you can go ahead and drop your database if you wish.
But for the sake of this course and we're going to maintain these because we've learned how to drop
our database.
So we're not going to drop this at all.
So go ahead and practice with these.
If you go ahead and uh, try as much as possible to play around with it.
And if you have any questions, go uh, use the question and answer section.
And I'm going to get back to you as soon as possible.
Thank you so much.
And I'm going to see you in the next video lecture.