Got it

The Series of MySQL - 4 - MySQL User Management - EP 04_01

Latest reply: May 21, 2022 08:39:23 419 14 11 0 0

The Series of MySQL -4- MySQL User Management - EP 04_01


HI Hi, Greetings!  i_f47.gif

Happy February i_f25.gif


Hi Everyone,


Today, I would like to share with you an article about the fourth episode of Series of MySQL (MySQL Database), and the content is given below.

 

a.    Create Database

b.   Select Database

c.    Show Databases

d.   Drop Database

e.   Copy Database 


Create Database


A database is used to organize and store a collection of records. It lets us to organize data into tables, rows, columns, and indexes so that we can quickly access the information we need. We can quickly access and manage the records using the database.


A database in MySQL is implemented as a directory that contains all files in the form of a table. It allows us to establish a database in a variety of methods, the most common of which are:

  1. MySQL Command Line Client

  2. MySQL Workbench


MySQL Command Line Client


Using the CREATE DATABASE statement with the following syntax, we may create a new database in MySQL:


CREATE DATABASE [IF NOT EXISTS] database_name  

[CHARACTER SET charset_name]  

[COLLATE collation_name];  


Parameter Explanation

The following are the parameter descriptions for the above syntax:


·                 database_name

It's the name of a new database in the MySQL server instance that should be unique. When we create a database that already exists, the IF NOT EXIST clause prevents an error.


·                 charset_name

It's a choice. It's the name of the character set that's used to hold all of the characters in a string. The MySQL database server can handle a wide range of character sets. MySQL uses the default character set if we don't specify it in the statement.


·                 collation_name

It compares characters from a certain character set and is optional.


Example


let's learn how to establish a database in MySQL. If we set the password during installation, open the MySQL console and write it down. We're now ready to build a database. We'll use the following statement to establish a database called "empdb":


mysql> CREATE DATABASE empdb;  


It will look like the below output:


1



We can look over the freshly constructed database with the query below, which returns the database name, character set, and collation:

mysql> SHOW CREATE DATABASE empdb;   



2


The following query can be used to check the database that has been created:

mysql> SHOW DATABASES;    


3


We can view all the created databases on the server after running the above query.


Finally, we can access the database with the command below, which allows us to construct tables and other database objects.

mysql> USE empdb;   


4

 

MySQL Workbench


It's a graphical user interface (GUI) tool for database architects, developers, and database administrators. SQL programming, data modeling, data migration, and complete administration tools for server configuration, user management, backup, and more are all supported by this visual tool. It enables us to construct new physical data models, E-R diagrams, and SQL queries (run queries, etc.).

 

To use this tool to create a new database, first-run MySQL Workbench and log in using the desired username and password. The following screen will appear:


5


To create a database, go through the procedures below:


1. Select the Schema menu from the Navigation tab. We can view all of the databases that have been built previously in this section. Right-click beneath the Schema menu and select Create Schema, or click the database icon (red rectangle), as seen in the following screen.


6


2. The new Schema window appears on the screen. Use the default character set and collation when creating a new database (for example, empdb1). Now, click the Apply button as seen on the screen below: click the Apply button:


7


3. A new popup window appears on the screen. Then press the Apply button.


8


4. On the screen, a new popup window emerges. To finalize the database construction, click the Finish button.


9


5. We can notice new databases in the Schema menu after successful database creation. If we don't see it, go to the Schema menu and click the refresh icon.


6. By picking the database and clicking the I button; we can get more information about it. Table, Triggers, Indexes, Users, and many more choices are displayed in the information box.


10




7. Although MySQL Workbench does not allow us to rename the database, we may add, edit, and delete tables and data rows from it.


You are welcome to like and leave feedback in the comment area.


Link:


EP 03_02:



EP 03_03:


EP 03_04:


EP 03_05:

Source:

  • https://www.w3schools.com/mySQl/default.asp

  • https://www.mysqltutorial.org/mysql-basics/


M M Zaheer Hussain

Stay Safe!

tt


The post is synchronized to: Author groupzaheernew's Author Collection

  • x
  • convention:

zaheernew
MVE Author Created Feb 18, 2022 09:43:12

  • x
  • convention:

wissal
wissal Created Feb 27, 2022 16:19:52 (0) (0)
Thank you, my friend  
Rumana
Created Feb 18, 2022 10:28:44

simple & excellent post
View more
  • x
  • convention:

Unicef
MVE Created Feb 18, 2022 11:59:38

THANKS FOR SHARING
View more
  • x
  • convention:

Saqib123
Moderator Created Feb 19, 2022 11:41:29

Thanks for sharing
View more
  • x
  • convention:

andersoncf1
MVE Author Created Feb 19, 2022 16:14:21

Well! Thank you
View more
  • x
  • convention:

zaheernew
zaheernew Created Feb 20, 2022 04:22:56 (0) (0)
Awesome  
MahMush
Moderator Author Created Feb 20, 2022 05:59:25

well done
View more
  • x
  • convention:

Zonger
Moderator Created Feb 20, 2022 08:32:48

good share
View more
  • x
  • convention:

Herediano
Created Feb 23, 2022 16:55:40

Thank you for such an useful post! Keep up the good work!
View more
  • x
  • convention:

Saqibaz
Created Feb 23, 2022 19:14:22

Thanks for sharing
View more
  • x
  • convention:

12
Back to list

Comment

You need to log in to comment to the post Login | Register
Comment

Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " User Agreement."

My Followers

Login and enjoy all the member benefits

Login

Block
Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Reminder
Please bind your phone number to obtain invitation bonus.
Information Protection Guide
Thanks for using Huawei Enterprise Support Community! We will help you learn how we collect, use, store and share your personal information and the rights you have in accordance with Privacy Policy and User Agreement.