您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

mysql怎么查询所有数据库

2025/2/11 18:29:09发布61次查看
mysql查询所有数据库的方法:1、使用mysql客户端登录到mysql数据库服务器;2、直接执行“show databases;”或“show schemas;”命令即可列出所有数据库。
本教程操作环境:windows7系统、mysql8版本、dell g3电脑。
要列出mysql服务器主机上的所有数据库,请使用show databases命令,如下所示:
show databases;
例如,要列出本地mysql数据库服务器中的所有数据库,请首先登录到数据库服务器,如下所示:
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>
然后使用show databases命令:
mysql> show databases;+--------------------+| database |+--------------------+| information_schema || crmdb || mysql || newdb || performance_schema || testdb || yiibaidb || yiibaidb_backup |+--------------------+8 rows in set
show schemas命令是show databases的同义词,因此以下命令将返回与上述相同的结果:
mysql> show schemas;+--------------------+| database |+--------------------+| information_schema || crmdb || mysql || newdb || performance_schema || testdb || yiibaidb || yiibaidb_backup |+--------------------+8 rows in set
如果要查询与特定模式匹配的数据库,请使用like子句,如下所示:
show databases like pattern;
例如,以下语句返回以字符串“schema”结尾的数据库;
mysql> show databases like '%schema';+--------------------+| database (%schema) |+--------------------+| information_schema || performance_schema |+--------------------+2 rows in set
重要的是要注意,如果mysql数据库服务器以-skip-show-database启动,则除非具有show databases权限,否则不能使用show databases语句。
【相关推荐:mysql视频教程】
以上就是mysql怎么查询所有数据库的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product