- Display database
Command: show databases.
Effect: Lists all databases in the current database server.
- Switching databases
Command: use database_name.
Effect: Switch database.
- Displays all tables in the database
Run the show tables command.
Function: Displays all tables in a database.
- Displays all columns in the table
Run the show full columns tables_name command.
Function: Displays all columns in a table.
- Checking the MySQL version
Command: select version(); .
Function: View the server version.
- Viewing the Current User
Select current_user();
Function: Displays the current login user
- Display information about a single table
Command: show table status like table_name.
Function: Displays table details.
- Display the number of processes
Command: show processList.
Effect: Displays the number of processes operating on the database.
- According to the index
Command: show index from table_name;
Function: Displays all indexes in a table.
- Viewing the Execution Plan
Command: explain query statement.
Function: Displays the execution of a query statement, often used for SQL optimization.