mysql数据库命令查看数据库信息。

时间:2021-10-08 01:34:27

1、通过sql查看 数据库的所有表名:

SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '数据库名'
;

或者:

SHOW TABLES;


mysql数据库命令查看数据库信息。


SHOW DATABASES;
SHOW TABLES FROM test;
SHOW CREATE TABLE t_blog;


CREATE TABLE `t_blog` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `age` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1


SHOW TABLE STATUS FROM test;
SHOW COLUMNS FROM t_blog FROM test;
SHOW FULL COLUMNS FROM t_blog FROM test;
SHOW FIELDS FROM t_blog FROM test;
SHOW FULL FIELDS FROM t_blog FROM test;
DESCRIBE t_blog;
DESCRIBE t_blog age;
SHOW INDEX FROM t_blog FROM test;
SHOW STATUS;
SHOW VARIABLES;
SHOW PROCESSLIST;
SELECT USER();
SHOW GRANTS FOR root@localhost;