0

How to determine the current size of a MySQL Database

Background

Sometimes you may need to limit the size of a particular MySQL specially for demo applications. Limiting the size of a database requires determining its current size before any insert operation. This article demonstrates how to use SQL to retrieve the current database size.

Software Environment

  • Windows 7 Professional SP1
  • MySQL 5.6.16 – Community Server (GPL)

The SQL Select Statement

The SQL statement below retrieves the needed data from information_schema.TABLES table. You database user must have priviledge to run queries against the table in information_schema.

Sample Output

mysql_db_current_size

Karl San Gabriel

Karl San Gabriel

Java and Enterprise Technologies Expert