mysql查看表的存储引擎、表结构等相关信息
以下均为查看mytable表的信息
1.查看表的存储引擎、记录数等
mysql> show table status like 'mytable' \G; *************************** 1. row *************************** Name: mytable #表名 Engine: InnoDB #存储引擎伟InnoDB Version: 10 #mysql版本 Row_format: Compact #行格式。有Dynamic,fixed,Compact等格式。Dynamic是动态行,表字段里面宝航varchar,BloB等不定长字段。fixed是定长行。Compact是行压缩。 Rows: 0 #表中的行数 Avg_row_length: 0 #平均每行的字节数 Data_length: 16384 #整个表的数据量(字节) Max_data_length: 0 #表最大的容量。0表示无限 Index_length: 0 #索引数据占用磁盘空间的大小 Data_free: 10485760 #表示已分配但还未被使用的空间大小。 Auto_increment: NULL #下一个AUto_increment的值 Create_time: 2011-08-06 22:39:46 #创建时间 Update_time: NULL #更新时间 Check_time: NULL #使用check table等命令时的检查时间 Collation: utf8_general_ci #默认字符集和字符列排列顺序 Checksum: NULL #如果启动,则表示整个表的校验和 Create_options: max_rows=4294967295 avg_row_length=32 #表创建时的选项 Comment: 1 row in set (0.00 sec)
2.查看表结构信息
mysql> desc mytable; +---------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------+-------------+------+-----+---------+-------+ | keyword | varchar(64) | NO | PRI | NULL | | | queries | int(10) | YES | | NULL | | +---------+-------------+------+-----+---------+-------+
mysql> show create table mytable; CREATE TABLE `mytable` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` text NOT NULL, `content` text NOT NULL, `ordering` int(11) NOT NULL DEFAULT '0', `position` varchar(50) DEFAULT NULL, `checked_out` int(11) unsigned NOT NULL DEFAULT '0', `checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `published` tinyint(1) NOT NULL DEFAULT '0', `module` varchar(50) DEFAULT NULL, `numnews` int(11) NOT NULL DEFAULT '0', `access` tinyint(3) unsigned NOT NULL DEFAULT '0', `showtitle` tinyint(3) unsigned NOT NULL DEFAULT '1', `params` text NOT NULL, `iscore` tinyint(4) NOT NULL DEFAULT '0', `client_id` tinyint(4) NOT NULL DEFAULT '0', `control` text NOT NULL, PRIMARY KEY (`id`), KEY `published` (`published`,`access`), KEY `newsfeeds` (`module`,`published`) ) ENGINE=MyISAM AUTO_INCREMENT=145 DEFAULT CHARSET=utf8
use information_schema; select * from columns where table_name='mytable';
此博客已不再更新,如需查看最新文章请访问雪洁之家
分类:
数据库
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构