MySQL get the size of all databases

Below is the query to get the size of all databases:

SELECT 
    table_schema AS 'DatabaseName',
    ROUND(SUM(data_length + index_length) / 1024 / 1024,
            1) 'Database size in MB'
FROM
    information_schema.tables
GROUP BY table_schema; 

The above query was in MB, if you want to get the size in GB, you can run the below query:

SELECT 
    table_schema AS 'DatabaseName',
    ROUND(SUM(data_length + index_length) / 1024 / 1024 / 1024,
            1) 'Database size in GB'
FROM
    information_schema.tables
GROUP BY table_schema;