SHOW DATABASES //列出 MySQL Server 数据库。 SHOW TABLES [FROM db_name] //列出数据库数据表。 SHOW CREATE TABLES tbl_name //导出数据表结构。 SHOW TABLE STATUS [FROM db_name] //列出数据表及表状态信息。 SHOW COLUMNS FROM tbl_name [FROM db_name] //列出资料表字段 SHOW FIELDS FROM tbl_name [FROM db_name],DESCRIBE tbl_name [col_name]。 SHOW FULL COLUMNS FROM tbl_name [FROM db_name]//列出字段及详情 SHOW FULL FIELDS FROM tbl_name [FROM db_name] //列出字段完整属性 SHOW INDEX FROM tbl_name [FROM db_name] //列出表索引。 SHOW STATUS //列出 DB Server 状态。 SHOW VARIABLES //列出 MySQL 系统环境变量。 SHOW PROCESSLIST //列出执行命令。 SHOW GRANTS FOR user //列出某用户权限 DESC TABLE //获取表详细信息 1. mysql_connect("localhost","root",""); mysql_select_db("test"); $query= "desc student"; $result= mysql_query($query); while($row=mysql_fetch_assoc($result)){ print_r($row); } ?> 2. mysql_connect("localhost","root",""); mysql_select_db("test"); $query= "SHOW FULL COLUMNS FROM student"; $result= mysql_query($query); while($row=mysql_fetch_assoc($result)){ print_r($row); } ?> 3. mysql_connect("localhost","root",""); mysql_select_db("test"); $query= "SELECT * FROM student LIMIT 1"; $result= mysql_query($query); $fields= mysql_num_fields($result); for($count=0;$count<$fields;$count++) { $field= mysql_fetch_field($result,$count); print_r($field); } ?>