Viewing MySQL databases is one of our most common operations. The following describes frequently used commands for viewing MySQL Databases in detail. If you are interested in viewing MySQL databases, take a look.
Go to MySQL Command line client
View the currently used database:
Mysql> select database ();
Mysql> status;
Mysql> show tables;
Mysql> show databases; // you can check which databases exist and return the Database Name (databaseName)
Mysql> use databaseName; // Replace the currently used database
Mysql> show tables; // returns the names of all tables in the current database.
Alternatively, you can directly use the following command
Mysql> show tables from databaseName; // databaseName can be obtained using show databases.
Run the following command to view the table structure in mysql:
Desc table name;
Show columns from table name;
Or
Describe table name;
Show create table name;
Or
Use information_schema
Select * from columns where table_name = 'table name ';
View warning:
Rows matched: 1 Changed: 0 Warnings: 1
Mysql> show warnings;
+ --------- + ------ + --------------------------------------------- +
| Level | Code | Message |
+ --------- + ------ + --------------------------------------------- +
| Warning | 1265 | Data truncated for column 'name' at row 3 |
+ --------- + ------ + --------------------------------------------- +
1 row in set
How to display MYSQL table information
Three Common MySQL table creation statements
MySQL connection Query
How to Implement MySQL multi-Table insertion
Two tips for MySQL table repair