新萄京计算机网络

 新萄京计算机网络     |      2019-12-13

骨子里我们用到的只是mysql教程 show用法的莫过于贰个了,在mysql轻松操作如下

直接cmd命令形式下采用

show table

 代码如下

如此就能够突显全部表了,但在php教程中有所不一样,大家看上面代码

show databases;
show tables from db_name;

$server = 'localhost';
$user = 'root';
$pass = '';
$dbname = 'dayanmei_com';
$conn = mysql_connect($server,$user,$pass);
if(!$conn卡塔尔(قطر‎ die("数据库教程系统连接失利!"卡塔尔国;
mysql_select_db($dbname卡塔尔国 or die("数据库连接失利!"卡塔尔(قطر‎;
$result = mysql_query("show tables");
while($row = mysql_fetch_array($result))
{
echo $row[0]."";
}
mysql_free_result($result);

 

利用mysql_query查询函数把重回表保存到三个数目,那样再遍历出来。

show columns from table_name from db_name;
show index from talbe_name [from db_name];

关于show的别样操作

show status;
show variables;

show databases;
show tables from db_name;

 

show columns from table_name from db_name;
show index from talbe_name [from db_name];

show status;
show variables;

show [full] processlist;
show table status [from db_name];

show grants for user;

show [full] processlist;
show table status [from db_name];

除了status,processlist和grants外,其它的都得以分包like wild选项,它能够利用sql的'%'和'_'字符;

show grants for user;