In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces mysql how to query all databases, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
Mysql query all databases: 1, use the MySQL client to log in to the MySQL database server; 2, directly execute the "SHOW DATABASES;" or "SHOW SCHEMAS;" command to list all databases.
The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.
"to list all databases on the MySQL server host, use the SHOW DATABASES command, as follows:"
SHOW DATABASES
For example, to list all the databases in the local MySQL database server, log in to the database server first, as follows:
C:\ Users\ Administrator > mysql-u root-pEnter password: * Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 7Server version: 5.7.9 MySQL Community Server (GPL) Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.mysql >
Then use the SHOW DATABASES command:
Mysql > SHOW DATABASES;+-+ | Database | +-+ | information_schema | | crmdb | | mysql | | newdb | | performance_schema | | testdb | | yiibaidb | | yiibaidb_backup | +-+ 8 rows in set
The SHOW SCHEMAS command is synonymous with SHOW DATABASES, so the following command returns the same result as above:
Mysql > SHOW SCHEMAS;+-+ | Database | +-+ | information_schema | | crmdb | | mysql | | newdb | | performance_schema | | testdb | | yiibaidb | | yiibaidb_backup | +-+ 8 rows in set
If you want to query a database that matches a specific pattern, use the LIKE clause, as follows:
SHOW DATABASES LIKE pattern
For example, the following statement returns a database that ends with the string "schema"
Mysql > SHOW DATABASES LIKE'% schema';+-+ | Database (% schema) | +-+ | information_schema | | performance_schema | +-+ 2 rows in set
It is important to note that if the MySQL database server is started with-skip-show-database, you cannot use the SHOW DATABASES statement unless you have SHOW DATABASES permission.
Thank you for reading this article carefully. I hope the article "how to query all databases in mysql" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
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.