In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Editor to share with you MySQL how to view which databases, I believe that most people do not know very well, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
In MySQL, you can use the "SHOW DATABASES" statement to see which databases are available, which can view or display all databases within the current user's permissions, with the syntax "SHOW DATABASES [LIKE 'string'];".
The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.
In MySQL, you can use SHOW DATABASES statements to view or display databases that are within the scope of the current user's permissions. The syntax format for viewing the database is:
SHOW DATABASES [LIKE 'string']
The syntax is as follows:
The LIKE clause is optional and matches the specified database name. LIKE clauses can be partially matched or completely matched.
The string is surrounded by single quotes'', specifying the string to match; the string can be a complete string or it can contain wildcards.
The LIKE keyword supports percent sign "%" and underscore "_" wildcards.
Wildcards are special statements that are mainly used to obfuscate queries. When you don't know the real characters or don't bother to enter the full name, you can use wildcards instead of one or more real characters.
1. Use SHOW DATABASES to view all databases directly
List all databases that can be viewed by the current user:
Mysql > SHOW DATABASES +-+ | Database | +-+ | information_schema | | mysql | | performance_schema | | sakila | | sys | | test_db | | world | +-+ 7 row in set (0.22 sec)
2. Use LIKE clause and fuzzy query.
First create three databases, named test_db, db_test, and db_test_db.
1) use the LIKE clause to view the database that exactly matches the test_db:
Mysql > SHOW DATABASES LIKE 'test_db';+-+ | Database (test_db) | +-+ | test_db | +-+ 1 row in set (0.03 sec)
2) use the LIKE clause to view the database whose name contains test:
Mysql > SHOW DATABASES LIKE'% test%' +-+ | Database (% test%) | +-+ | db_test | +-+ | db_test_db | +-+ | test_db | | +-+ 3 row in set (0.03 sec) |
3) use the LIKE clause to view the database whose name begins with db:
Mysql > SHOW DATABASES LIKE 'db%';+-+ | Database (db%) | +-+ | db_test | +-+ | db_test_db | +-+ 2 row in set (0.03 sec)
4) use the LIKE clause to view the database whose name ends in db:
Mysql > SHOW DATABASES LIKE'% db' +-+ | Database (% db) | +-+ | db_test_db | +-+ | test_db | +-+ 2 row in set (0.03 sec) are all the contents of the article "how to View databases in MySQL" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.