1. Display database

Command: show databases.

Effect: Lists all databases in the current database server.

  1. Switching databases

Command: use database_name.

Effect: Switch database.

  1. Displays all tables in the database

Run the show tables command.

Function: Displays all tables in a database.

  1. Displays all columns in the table

Run the show full columns tables_name command.

Function: Displays all columns in a table.

  1. Checking the MySQL version

Command: select version(); .

Function: View the server version.

  1. Viewing the Current User

Select current_user();

Function: Displays the current login user

  1. Display information about a single table

Command: show table status like table_name.

Function: Displays table details.

  1. Display the number of processes

Command: show processList.

Effect: Displays the number of processes operating on the database.

  1. According to the index

Command: show index from table_name;

Function: Displays all indexes in a table.

  1. Viewing the Execution Plan

Command: explain query statement.

Function: Displays the execution of a query statement, often used for SQL optimization.