show tables;
DESCRIBE table_name; # To show table structure...
DESCRIBE my_table;
use DATABASE_NAME;
describe TABLE_NAME;
use database_name;
show tables;
Code language: SQL (Structured Query Language) (sql)
mysql -e 'show tables;' database_name
DESCRIBE table_name; /* List all columns of a database's table*/
Copied mysql> DESCRIBE pet;
+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| name | varchar(20) | YES | | NULL | |
| owner | varchar(20) | YES | | NULL | |
| species | varchar(20) | YES | | NULL | |
| sex | char(1) | YES | | NULL | |
| birth | date | YES | | NULL | |
| death | date | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+
Copied mysql> SHOW CREATE TABLE tG
*************************** 1. row ***************************
Table: t
Create Table: CREATE TABLE `t` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`s` char(60) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
# First, select your database
USE yourDb;
# Then, simply
SHOW TABLES;