解析MYSQL显示表信息的方法
时间:2024-01-15 12:17:49
在用mysql时(show tables),有时候需要查看表和字段的相关信息(表与某字段是否存在等.)~~而PHP提供了这样的相关函数,如:mysql_list_dbs(),mysql_list_fields(),但mysql_list_fields() 函数等已过时,所以要用show...这个SQL指令来查寻。
SHOW 指令(‘[..]'里的可选)
#显示mysql中所有数据库的名称
show databases;
#显示mysql中的相关表
show tables [ from db_name]
#显示数据表表状态信息
show table status
#查看存储过程状态
show procedure status
#列出表字段完整属性
show full fields from tbl_name
#显示表中列名称
show columns from table_name [ from database_name ] ; 或show columns from database_name.table_name;
#显示一个用户的权限,显示结果类似于grant 命令
show grants for user_name;
#列出表索引
show index from tbl_name
#显示表的索引
show index from table_name
#显示一些系统特定资源的信息,例如,正在运行的线程数量
show status [from db_name]
#显示系统变量的名称和值
show [ global] variables
#显示系统中正在运行的所有进程,也就是当前正在执行的查询大多数用户可以查看他们自己的进程,但是如果他们拥有process权限,就可以查看所有人的进程,包括密码
show processlist
#显示当前使用或者指定的database中的每个表的信息信息包括表类型和表的最新更新时间
show table status
#显示服务器所支持的不同权限
show privileges
#显示create database 语句是否能够创建指定的数据库
show create database database_name
#显示create database 语句是否能够创建指定的数据库
show create table table_name
#显示安装以后可用的存储引擎和默认引擎
show engies
#显示innoDB存储引擎的状态
show innodb status
#显示BDB存储引擎的日志
show logs -----这个已经被遗弃了
#显示最后一个执行的语句所产生的错误、警告和通知
show warnings
#只显示最后一个执行语句所产生的错误
show errors
#显示安装后的可用存储引擎和默认引擎
show [storage] engines;
============================================================
mysqlshow,该指令只参显示数据库、表、列的信息
例如:mysqlshow -uroot -pXXXX mysql #显示mysql数据库的信息
例如:mysqlshow -uroot -pXXXX mysql user #显示mysql数据库中user表的信息
例如:mysqlshow -uroot -pXXXX mysql user user #显示mysql数据库中user表中的user列的信息
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
SQL Server的彻底卸载与再次安装方式
![](https://img.aspxhome.com/file/2023/3/89663_0s.png)
PyQt5 显示超清高分辨率图片的方法
![](https://img.aspxhome.com/file/2023/8/114498_0s.png)
Python实现读写INI配置文件的方法示例
influx+grafana自定义python采集数据和一些坑的总结
![](https://img.aspxhome.com/file/2023/6/107246_0s.png)
django中操作mysql数据库的方法
![](https://img.aspxhome.com/file/2023/9/133709_0s.png)
Python实现Word的读写改操作
![](https://img.aspxhome.com/file/2023/2/93462_0s.png)
FCKeditor 编辑器实战技巧 Ⅰ
![](https://img.aspxhome.com/file/uploadpic/20071/200713110656772.gif)
Python视频爬虫实现下载头条视频功能示例
![](https://img.aspxhome.com/file/2023/8/121478_0s.jpg)
python 对任意数据和曲线进行拟合并求出函数表达式的三种解决方案
![](https://img.aspxhome.com/file/2023/9/67349_0s.jpg)
详解MySQL导出指定表中的数据的实例
python编写Logistic逻辑回归
![](https://img.aspxhome.com/file/2023/6/120336_0s.jpg)
MySql存储过程和游标的使用实例
Python利用redis-py实现集合与有序集合的常用指令操作
![](https://img.aspxhome.com/file/2023/2/127622_0s.jpg)
提高ASP性能的最佳选择第二部分
使用scrapy ImagesPipeline爬取图片资源的示例代码
Python中排序函数sorted()函数的使用实例
![](https://img.aspxhome.com/file/2023/5/117465_0s.jpg)
阿里巴巴中秋节logo设计的艰辛曲折过程
![](https://img.aspxhome.com/file/UploadPic/20089/11/2008911171924597s.jpg)
sqlserver 聚集索引和非聚集索引实例
非常全面的实用JavaScript开发工具列表
![](https://img.aspxhome.com/file/UploadPic/20101/11/200912311344278032-17s.jpg)