mysql 查看数据库、表的基本命令

1:show databases;

查看所有的数据库,等同于select schema_name from information_schema.schemata\G。\G 替换;,以纵向报表的形式输出结果,有利于阅读。

  1. status 查看mysql数据库的运行状态

  2. use 命令选择数据库 例如 use information_schema,当使用此命令后

select schema_name from information_schema.schemata\G,可以为

select schema_name from schemata\G

  1. 查看数据库中的表

show tables

同样也可以在information_schema中查看,show命令是方便使用的简短模式。

select table_name from tables where table_schema='jblog';

  1. 查看表结构

desc table_name;

6.查看表状态 show table status from db like 条件

可以查看engine数据库引擎,version,row、index等信息

7.小技巧,当多行命令输入,发现错误后,用\c结束。


另,查询数据库运行状态的基本命令:

#查询数据库连接

show ``full processlist;

show status ``like '%Max_used_connections%'``;

show status ``like '%Threads_connected%'``;#当前连接数

show status ``like '%table_lock%'``;#表锁定

show status ``like 'innodb_row_lock%'``;#行锁定

show status ``like '%qcache%'``; #查询缓存情况

show variables ``like "%query_cache%"``;

SHOW STATUS ``LIKE 'Qcache%'``;

show variables ``like "%binlog%"``;

show status ``like 'Aborted_clients'``;#由于客户没有正确关闭连接已经死掉,已经放弃的连接数量

show variables ``like '%max_connections%'``;//查看最大连接数量

show variables ``like '%timeout%'``;#查看超时时间

show variables ``like 'log_%'``; #查看日志是否启动

相关推荐
handler0110 分钟前
【MySQL】常用命令总结(库与表增删查改)
运维·数据库·mysql·命令·总结
week@eight18 分钟前
Linux - Doris
linux·运维·数据库·mysql
苏渡苇2 小时前
Spring Cloud Alibaba:将 Sentinel 熔断限流规则持久化到 Nacos 配置中心
数据库·spring boot·mysql·spring cloud·nacos·sentinel·持久化
杨云龙UP3 小时前
Oracle Recycle Bin 回收站详解:DROP TABLE 后还能找回吗?
linux·运维·数据库·sql·mysql·oracle
Fanta丶4 小时前
7.MySql函数使用 字符串、数值、日期、流程函数
mysql
代码中介商6 小时前
MySQL 存储过程与触发器完全指南
数据库·mysql
Yupureki6 小时前
《MySQL数据库基础》9.索引原理
linux·运维·服务器·网络·数据库·mysql
李少兄6 小时前
MySQL分页重复问题深度剖析
android·数据库·mysql
Yupureki7 小时前
《MySQL数据库基础》8.复合查询
linux·运维·服务器·网络·数据库·mysql
AI人工智能+电脑小能手8 小时前
【大白话说Java面试题 第78题】【Mysql篇】第8题:解释下最左前缀原则?
java·开发语言·数据库·mysql·面试