Got it

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

Latest reply: May 21, 2022 08:34:21 584 15 12 0 0

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




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 

 

Show Databases

 

When working with the MySQL server, we frequently need to display or list the databases, as well as information on user accounts and their privileges on the server. We'll look at how to list databases on the MySQL server in this article.


The following command, as shown below, will list all of the databases available on the MySQL server host:

mysql> SHOW DATABASES; 


Open the MySQL Command Line Client by typing mysql> in the prompt. Then, using the password you created during MySQL installation, log in to the MySQL database server. You've now established a connection to the MySQL server host, from which you can execute all SQL statements. Finally, to list/show databases, use the SHOW Databases command.

The following output provides a more detailed explanation:


12


A "SHOW SCHEMAS" statement in MySQL can also be used to display a list of databases. This command is a synonym for SHOW DATABASES, and it produces the same results. With the following output, we can understand it:


13


Using pattern matching to create a list of databases

 

The Show Databases command in MySQL also has a filtering option that lets us use the LIKE and WHERE clauses to filter the returned database. The LIKE clause returns a list of database names that match the pattern. The WHERE clause gives you more options when it comes to listing the databases that match the SQL statement's criterion.


Syntax

The syntax for using pattern matching with the Show Databases command is as follows:

 mysql> SHOW DATABASES LIKE pattern;  

OR,  

mysql> SHOW DATABASES WHERE expression;  

 

With the example below, where the percent (%) sign assumes zero, one, or many characters, we can grasp it:

mysql> SHOW DATABASES LIKE "%schema"; 

 

The output of the preceding statement is as follows:

14


When the LIKE clause is insufficient, a more complicated search can be used to query database information from the schemata table in the information schema. The information schema in MySQL is an information database, thus we can utilize it with the SHOW DATABASES command to receive the output.


mysql> SELECT schema_name FROM information_schema.schemata;  


The outcome of this statement is the same as the SHOW DATABASES command:

14


Now we'll learn how to use the WHERE clause in conjunction with the SHOW DATABASES command. The database whose schema name begins with "s" is returned by this statement:


mysql>SELECT schema_name FROM information_schema.schemata WHERE schema_name LIKE 's%';  

 

It will produce the following results:

16


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


Link:


EP 03_01:

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




EP 03_02:

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



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:56:29

  • x
  • convention:

little_fish
little_fish Created Feb 18, 2022 10:45:07 (0) (0)
 
andersoncf1
andersoncf1 Created Feb 19, 2022 16:12:02 (0) (0)
 
BWGARM
BWGARM Created Feb 21, 2022 05:31:29 (0) (0)
 
Rumana
Created Feb 18, 2022 10:28:23

simple & excellent post
View more
  • x
  • convention:

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

GOOD THANKS
View more
  • x
  • convention:

Saqib123
Created Feb 19, 2022 11:41:46

Thanks for sharing
View more
  • x
  • convention:

andersoncf1
MVE Author Created Feb 19, 2022 16:12:15

Well! Thank you
View more
  • x
  • convention:

zaheernew
zaheernew Created Feb 20, 2022 09:54:30 (0) (0)
Great  
Zonger
Created Feb 20, 2022 08:33:31

thanks for sharing
View more
  • x
  • convention:

zaheernew
zaheernew Created Feb 20, 2022 09:54:13 (0) (0)
Great  
Herediano
Created Feb 23, 2022 16:55:14

Helpful post! thank you for sharing!
View more
  • x
  • convention:

Saqibaz
Created Feb 23, 2022 19:15:10

Helpful post!
View more
  • x
  • convention:

MahMush
Moderator Author Created Mar 14, 2022 05:01:35

very welldone
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.