首页 > 代码库 > dos下连接mysql,显示表结构

dos下连接mysql,显示表结构

C:\Windows\system32>mysql -hlocalhoset -uroot -pEnter password: *****mysql> use sshDatabase changedmysql> show tables;+----------------+| Tables_in_ssh  |+----------------+| admin          || department     || privilege      || privilege_role || role           || user_role      |+----------------+6 rows in set (0.00 sec)

//显示表结构1)mysql> desc admin;+---------------+--------------+------+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+---------------+--------------+------+-----+---------+-------+| id | varchar(255) | NO | PRI | NULL | || name | varchar(255) | YES | | NULL | || account | varchar(255) | YES | | NULL | || password | varchar(255) | YES | | NULL | || addTime | datetime | YES | | NULL | || delSign | varchar(255) | YES | | NULL | || lockStatus | varchar(255) | YES | | NULL | || phone | varchar(255) | YES | | NULL | || email | varchar(255) | YES | | NULL | || nowLoginTime | datetime | YES | | NULL | || nowLoginIp | varchar(255) | YES | | NULL | || lastLoginTime | datetime | YES | | NULL | || lastLoginIp | varchar(255) | YES | | NULL | || loginCount | int(11) | YES | | NULL | || description | varchar(255) | YES | | NULL | || gender | varchar(255) | YES | | NULL | || birthday | datetime | YES | | NULL | || icon | varchar(255) | YES | | NULL | || qq | varchar(255) | YES | | NULL | || address | text | YES | | NULL | || departmentId | varchar(255) | YES | MUL | NULL | |+---------------+--------------+------+-----+---------+-------+

  

2)mysql> show create table admin;------------------------------------+| admin | CREATE TABLE `admin` (  `id` varchar(255) NOT NULL,  `name` varchar(255) DEFAULT NULL,  `account` varchar(255) DEFAULT NULL,  `password` varchar(255) DEFAULT NULL,  `addTime` datetime DEFAULT NULL,  `delSign` varchar(255) DEFAULT NULL,  `lockStatus` varchar(255) DEFAULT NULL,  `phone` varchar(255) DEFAULT NULL,  `email` varchar(255) DEFAULT NULL,  `nowLoginTime` datetime DEFAULT NULL,  `nowLoginIp` varchar(255) DEFAULT NULL,  `lastLoginTime` datetime DEFAULT NULL,  `lastLoginIp` varchar(255) DEFAULT NULL,  `loginCount` int(11) DEFAULT NULL,  `description` varchar(255) DEFAULT NULL,  `gender` varchar(255) DEFAULT NULL,  `birthday` datetime DEFAULT NULL,  `icon` varchar(255) DEFAULT NULL,  `qq` varchar(255) DEFAULT NULL,  `address` text,  `departmentId` varchar(255) DEFAULT NULL,  PRIMARY KEY (`id`),  KEY `FK586034F91261A86` (`departmentId`),  CONSTRAINT `FK586034F91261A86` FOREIGN KEY (`departmentId`) REFERENCES `department` (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 |+-------+--------------------------------------------------------------------------------------

  

3)show columns from admin;

4)describe admin;

dos下连接mysql,显示表结构