View remaining database space capacity in MySQL.
You can use the following query to check the remaining space capacity in a MySQL database:
SELECT table_schema AS '数据库名',
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS '总大小(MB)',
ROUND(SUM(data_length) / 1024 / 1024, 2) AS '数据大小(MB)',
ROUND(SUM(index_length) / 1024 / 1024, 2) AS '索引大小(MB)',
ROUND(SUM(data_free) / 1024 / 1024, 2) AS '可用空间(MB)'
FROM information_schema.tables
GROUP BY table_schema;
This query will return the total size, data size, index size, and available space size of each database in megabytes. You can modify the query as needed to fit your environment.