MySQL – How to create a DB

By | 21/01/2020

In this post, we will see how to create a DB in MySQL, using MySQLWorkbench.
First of all, we open MySQLWorkbench, select our MySQL instance and we insert the password:

CREATE DB
We push on the “new schema” icon, insert the Db name “DbManagerUser” and then we push the Apply button:

CREATE TABLES
We select the new schema and then we push the icon “Create Table”:

Then, we create the table TabUserType:

and finally, we create the table TabUser:

Now, in order to add data into the tables, we run this script:

insert into TabUserType (UserType) values ('Admin');
insert into TabUserType (UserType) values ('Reader');
insert into TabUserType (UserType) values ('Testing');

insert into TabUser (UserName, UserType) values ('Admin1', 1);
insert into TabUser (UserName, UserType) values ('Reader1', 2);
insert into TabUser (UserName, UserType) values ('Reader2', 2);
insert into TabUser (UserName, UserType) values ('Reader3', 2);
insert into TabUser (UserName, UserType) values ('Test1', 3);
insert into TabUser (UserName, UserType) values ('Test2', 3);



Finally, we run this query in order to verify everything worked fine:



Leave a Reply

Your email address will not be published. Required fields are marked *