SoFunction
Updated on 2025-03-03

Common scripts for how to view database variable information in MySql

1. Check the storage engine in use

show variables like '%storage_engine%';

2. View all storage engines provided by the database

show engines;

3. Check the current database version

select version() from dual;

4. View and set the transaction isolation level of the current library

-- Set transaction isolation level
set transaction_isolation='REPEATABLE-READ';
 
-- View transaction isolation level
show variables like '%isolation%';

5. Check table status information

show table status WHERE 1=1  AND NAME IN ('Table name');

6. View all field information of the table

show full fields from `Table name`;

7. View, set (modify) the character encoding of the database table

-- View all supported character set encodings
SHOW VARIABLES WHERE Variable_name LIKE 'character_set_%' OR Variable_name LIKE 'collation%';
  
-- View the character set encoding used by a table
show table status from Library name like 'Table name';
  
-- Modify the character set encoding of a table,For example:(utf8,utf8mb4)wait
ALTER TABLE Table name CHARACTER SET 'Character encoding';

8. View related process list, thing process, etc.

show processlist;

Summarize

The above is personal experience. I hope you can give you a reference and I hope you can support me more.