Database Limits Overview
MariaDB, like MySQL, has various limits related to connections, storage, queries, and performance. These limits can be controlled by server settings, hosting providers, or system resources.
Common MariaDB Limits and How to Manage Them
Maximum Number of Databases (Hosting Limit)
Issue:
You may see errors like:
You have reached your maximum allotment of databases (0) or (1).
Fix:
- Check database limit in hosting panel (cPanel, Plesk).
- Upgrade hosting plan for more databases.
- Use a single database with multiple tables instead.
Check database limits with:
SHOW DATABASES;
Maximum Connections (max_connections)
Issue:
If too many users connect at once, you may see:
ERROR 1040 (HY000): Too many connections
Fix:
- Increase max_connections in my.cnf:
Edit /etc/my.cnf or /etc/mysql/my.cnf
[mysqld]
max_connections = 500
- Restart MariaDB:
sudo systemctl restart mariadb
- Use connection pooling for efficient resource use.
Check current max connections:
SHOW VARIABLES LIKE 'max_connections';
Maximum Table Size (innodb_file_per_table)
Issue:
Large databases may hit storage limits:
Table is full
Fix:
- Enable innodb_file_per_table for independent table storage.
- Increase innodb_buffer_pool_size in my.cnf:
Add to my.cnf configuration
[mysqld]
innodb_file_per_table = 1
innodb_buffer_pool_size = 1G
- Use partitioning for large tables.
Check table size limit:
SHOW VARIABLES LIKE 'innodb_file_per_table';
Query Timeout (max_execution_time)
Issue:
Long queries may be killed:
Query execution was interrupted
Fix:
- Increase timeout in my.cnf:
Edit my.cnf configuration
[mysqld]
max_execution_time = 60000
- Optimize slow queries with indexes.
Check current timeout:
SHOW VARIABLES LIKE 'max_execution_time';
Maximum Packet Size (max_allowed_packet)
Issue:
Large query results may fail:
Got a packet bigger than 'max_allowed_packet' bytes
Fix:
- Increase max_allowed_packet in my.cnf:
Edit my.cnf configuration
[mysqld]
max_allowed_packet = 64M
- Restart MariaDB after changes.
Check packet size limit:
SHOW VARIABLES LIKE 'max_allowed_packet';
Table and Column Limits
| Limit Type | Default Value | Maximum Possible |
|---|---|---|
| Tables per Database | Unlimited (Practical: 100,000) | System-dependent |
| Columns per Table | 4096 (MyISAM) / 1017 (InnoDB) | System-dependent |
| Rows per Table | 264 (InnoDB) | System-dependent |
Check table details:
SHOW TABLE STATUS FROM database_name;
Summary
| Limit Type | Fix |
|---|---|
| Database Limit (Hosting) | Upgrade plan or use multiple tables in one database |
| Max Connections (max_connections) | Increase in my.cnf, restart MariaDB |
| Table Size (innodb_file_per_table) | Enable in my.cnf, optimize storage |
| Query Timeout (max_execution_time) | Increase in my.cnf, optimize queries |
| Max Packet Size (max_allowed_packet) | Increase in my.cnf, restart server |
Final Recommendation
Now you can manage MariaDB limits effectively! Regular monitoring and proper configuration can prevent most common database issues.


