Cloud House Technologies Logo
CloudHouse Technologies
HomeServicesProjectsBlogAbout UsCareersContact UsLogin
    Cloud House Technologies Logo
    CloudHouse Technologies
    HomeServicesProjectsBlogAbout UsCareersContact UsLogin

    DirectAdmin MySQL & MariaDB Optimization: Complete Server Speed Tuning Guide

    Priya

    Content Writer & Researcher

    Last Updated: 24 June 2026
    DirectAdmin MySQL & MariaDB Optimization: Complete Server Speed Tuning Guide
    🖥️

    Need Expert MySQL Tuning on Your DirectAdmin Server?

    Buffer pool sizing, slow query analysis, and connection limit tuning require server access and time. CloudHouse's managed DirectAdmin team handles MySQL and MariaDB performance optimisation as part of our ongoing server management service. Contact us today.

    🔧 Book Free DiagnosisCall NowWhatsApp
    🖥️12,400+PCs Fixed
    ⭐4.9★Google Rating
    ⚡<15 minAvg. Response
    🛡️ISO 27001Certified

    If your websites on DirectAdmin are slow or database queries are timing out, the most likely culprit is not your PHP configuration or your Apache settings — it is an out-of-the-box MySQL or MariaDB installation that was never tuned for your server's actual workload. Database servers ship with conservative defaults designed for minimal resource usage, not performance. This guide walks through the complete tuning workflow: from measuring your current baseline to editing my.cnf variables, running MySQLTuner, and using the slow query log to catch the queries that are dragging everything down.

    Why MySQL/MariaDB Is Usually the #1 Performance Bottleneck on DirectAdmin Servers

    Web applications make dozens or hundreds of database queries per page load. When the database engine is under-resourced or misconfigured, each query takes longer — and latency compounds. A page that should load in 300ms takes 3 seconds. Concurrent visitors make it worse: MySQL queues requests when it runs out of connections or buffers, and response times spike.

    The default MySQL/MariaDB configuration allocates a very small InnoDB buffer pool (often 128 MB), a low connection limit (151), and no query analysis tools enabled. On a server with 4 GB RAM or more, these defaults leave most of your hardware idle while MySQL struggles. A basic tuning session typically reduces query execution time by 30–70% and eliminates most timeout errors without additional hardware.

    Common signs that MySQL is your bottleneck on DirectAdmin:

    • Slow page loads specifically on database-heavy CMS sites (WordPress, Joomla, WooCommerce)
    • ERROR 1040: Too many connections in application logs
    • High CPU usage from the mysqld process even during moderate traffic
    • Frequent "waiting for query lock" errors in MySQL status output
    • DirectAdmin's monitoring showing database memory usage near 100%

    💡 None of these worked? Skip the guesswork.

    Get Expert Help →

    Pre-Tuning Checklist: What to Measure Before Touching Any Config

    Never tune MySQL blind. Measure first, change second, measure again. This prevents you from introducing regressions and gives you a before/after comparison that proves the tuning actually helped.

    1Record current MySQL status variables

    Log into MySQL as root and run:

    mysql -u root -p
    SHOW GLOBAL STATUS;
    SHOW GLOBAL VARIABLES;

    Pay attention to these key metrics:

    • Innodb_buffer_pool_read_requests vs Innodb_buffer_pool_reads — the ratio reveals your cache hit rate
    • Max_used_connections — the peak concurrent connection count since the server started
    • Threads_connected — current active connections
    • Questions — total queries executed (divide by Uptime for queries/second)
    • Slow_queries — count of queries that exceeded the slow query threshold
    2Check current server memory allocation

    Run free -h on the DirectAdmin server to see total RAM and current usage. Your MySQL tuning targets should be based on available RAM. As a rule of thumb:

    • MySQL InnoDB buffer pool should use 50–70% of total RAM on a dedicated database server
    • On a shared DirectAdmin server (web + database on the same machine), limit MySQL to 30–50% of RAM to leave room for Apache/Nginx, PHP-FPM, and the OS
    3Note your MySQL/MariaDB version
    mysql --version

    Some variables (like query_cache_type) were removed in MySQL 8.0. Confirm your version before applying configuration examples from online guides.

    Optimising my.cnf: Key Variables That Move the Needle

    The main MySQL configuration file on DirectAdmin servers is located at /etc/my.cnf or /etc/mysql/my.cnf. Open it as root and edit the [mysqld] section. After making changes, always back up the file first:

    cp /etc/my.cnf /etc/my.cnf.backup-$(date +%Y%m%d)

    InnoDB Buffer Pool Size

    This is the single most impactful setting. The InnoDB buffer pool caches data and indexes from your tables in RAM, reducing disk reads. On a server with 8 GB RAM where MySQL shares with web services, set:

    [mysqld]
    innodb_buffer_pool_size = 2G

    For a 16 GB server, 4–6 GB is appropriate. Monitor Innodb_buffer_pool_read_requests and Innodb_buffer_pool_reads after the change — the cache hit rate should exceed 99% (reads/read_requests < 0.01).

    InnoDB Buffer Pool Instances

    When the buffer pool exceeds 1 GB, split it into multiple instances to reduce contention:

    innodb_buffer_pool_instances = 4

    Set instances equal to roughly 1 per GB of buffer pool size, up to 8.

    Maximum Connections

    The default of 151 is often too low for DirectAdmin servers hosting dozens of WordPress sites. Increase it, but be aware that each connection consumes memory:

    max_connections = 300

    Base this on your Max_used_connections value — set it to about 25% above the peak. Do not blindly set it to 1000 or higher without increasing your thread stack size accordingly.

    Temporary Table Size

    Queries that cannot sort data in memory write temporary tables to disk, which is very slow. Increase the in-memory limit:

    tmp_table_size = 128M
    max_heap_table_size = 128M

    Thread Cache

    Caching threads avoids the overhead of creating and destroying them for each new connection:

    thread_cache_size = 16

    Query Cache (MariaDB 10.x and MySQL 5.x only)

    Query cache is removed in MySQL 8.0. On older versions, enable it with caution — it helps for read-heavy workloads but causes contention on write-heavy sites:

    query_cache_type = 1
    query_cache_size = 64M
    query_cache_limit = 2M

    Monitor Qcache_hits and Qcache_inserts — if the hit ratio is below 20%, disable query cache as it is adding overhead without benefit.

    After editing my.cnf, restart MySQL:

    systemctl restart mysql
    # or on older systems:
    service mysql restart

    Check the error log immediately to confirm there are no configuration errors:

    tail -50 /var/log/mysql/error.log

    Using MySQLTuner and the Percona Configuration Tool on DirectAdmin

    Rather than guessing at optimal values, use MySQLTuner — a Perl script that analyses your running MySQL instance and provides tailored recommendations based on actual usage patterns.

    Install and run MySQLTuner:

    wget http://mysqltuner.pl/ -O mysqltuner.pl
    perl mysqltuner.pl --user root --pass your_root_password

    MySQLTuner outputs a scored list of recommendations. Focus on items marked [!!] (warnings) first. Common recommendations include:

    • Increasing innodb_buffer_pool_size (the most common finding on new servers)
    • Adjusting max_connections based on actual peak usage
    • Enabling or disabling query cache based on read/write ratio
    • Increasing open_files_limit if the server is running many databases

    Let MySQLTuner run for at least 24 hours of production traffic before making changes. Its recommendations are only as good as the data — a server that has been running for 10 minutes will have misleading baseline metrics.

    The Percona Configuration Generator (tools.percona.com/wizard) is an online alternative that generates a complete my.cnf file based on your server specs and workload type. Enter your RAM, storage type (SSD vs. HDD), and workload (OLTP/web hosting) to get a starting configuration.

    Enabling and Analysing the Slow Query Log

    Even with a well-tuned my.cnf, poorly written queries can drag down database performance. The slow query log records every query that exceeds a time threshold, giving you the data to identify and fix the worst offenders.

    Enable the slow query log in my.cnf:

    [mysqld]
    slow_query_log = 1
    slow_query_log_file = /var/log/mysql/slow.log
    long_query_time = 1
    log_queries_not_using_indexes = 1

    long_query_time = 1 logs any query taking over 1 second. Start with 1–2 seconds to catch only the worst queries; lower to 0.5 later to find medium-slow queries. log_queries_not_using_indexes catches queries that perform full table scans — a common cause of slow WordPress sites with large post tables.

    Analyse the slow query log with pt-query-digest (Percona Toolkit):

    yum install percona-toolkit   # CentOS/AlmaLinux
    pt-query-digest /var/log/mysql/slow.log | head -100

    pt-query-digest groups similar queries together and ranks them by total execution time, showing you which query pattern is consuming the most database resources across all executions — not just the slowest individual run.

    Once you identify slow queries, the typical fixes are:

    • Add a missing index on the column used in the WHERE clause
    • Rewrite the query to avoid full table scans
    • Enable object caching at the application layer (Redis or Memcached) to reduce repeated identical queries

    Managing MySQL performance tuning across a DirectAdmin server with dozens of client accounts — monitoring buffer pool hit rates, reviewing slow query logs, adjusting connection limits as traffic grows — is ongoing work that compounds over time. CloudHouse's managed server team handles MySQL and MariaDB tuning, performance monitoring, and slow query remediation as part of our DirectAdmin management service.

    MySQL Optimisation Checklist for DirectAdmin

    • ✅ InnoDB buffer pool set to 30–70% of available RAM
    • ✅ Buffer pool instances = 1 per GB (up to 8)
    • ✅ max_connections set to 25% above peak Max_used_connections
    • ✅ tmp_table_size and max_heap_table_size raised to 128 MB
    • ✅ thread_cache_size set to 16 or higher
    • ✅ MySQLTuner run after 24 hours of production traffic
    • ✅ Slow query log enabled with 1s threshold
    • ✅ No [!!] warnings remaining in MySQLTuner output
    • ✅ InnoDB buffer pool cache hit rate above 99%

    Database performance on DirectAdmin comes down to a handful of configuration variables in my.cnf and the discipline to measure before and after every change. Set your InnoDB buffer pool to match your server's RAM, raise your connection and table size limits above the defaults, run MySQLTuner after a full day of production traffic, and enable the slow query log to identify the specific queries that need index work. Done in order, these steps will reduce your average query time significantly and eliminate most timeout errors on shared DirectAdmin hosting environments.

    Get the Free Linux Server Admin Cheatsheet (PDF)

    Essential commands for server management, networking, and troubleshooting — all on one printable page.

    Running Linux servers? Let us manage them for you.

    Our Managed Linux Server plans cover updates, security hardening, monitoring, and 24/7 incident response — so your servers stay up and your team stays focused.

    • Proactive OS patching and security updates
    • 24×7 monitoring with instant alerting
    • Backup configuration and disaster recovery
    • Dedicated Linux engineers on call
    See Pricing Plans →

    What our customers say

    “Our production server went down at 2 AM. CloudHouse had it back online in under 20 minutes. Incredible response time.”

    Arun S.

    CTO, SaaS Startup

    “They migrated our entire infrastructure from Ubuntu 18 to 22 with zero downtime. Couldn't have asked for better.”

    Deepak N.

    DevOps Lead

    Frequently Asked Questions

    The innodb_buffer_pool_size is the single most impactful variable. It controls how much RAM MySQL uses to cache data and indexes. On a shared DirectAdmin server, set it to 30-50% of total RAM. For example, on an 8 GB server, set innodb_buffer_pool_size = 2G. Monitor the InnoDB cache hit rate after the change — it should exceed 99%.

    Book your free 15-minute diagnosis

    A certified technician will call you back within 15 minutes during business hours.

    Share this article

    Leave a Comment

    Comments (0)

    Loading comments...

    DirectAdmin MySQL Running Slow?

    Untuned MySQL defaults are the #1 cause of slow websites on DirectAdmin hosting servers. CloudHouse Technologies manages MySQL and MariaDB performance for hosting companies — from initial my.cnf tuning to ongoing slow query monitoring and index optimisation.

    Call Now — FreeWhatsApp Us

    Why CloudHouse?

    • ISO 27001:2022 certified
    • 12,400+ devices supported
    • 4.9★ on Google
    • Sub-15-minute response

    CloudHouse Technologies

    Innovative cloud solutions for modern businesses. We deliver cutting-edge technology with exceptional service.

    Contact Us

    CloudHouse Technologies Pvt.Ltd
    Special Economic Zone(SEZ),
    Infopark Thirissur,4B-15,
    Indeevaram,Nalukettu Road,
    Koratty, Kerala, India-680308
    0480-27327360
    info@cloudhousetechnologies.com

    Quick Links

    • Our Services
    • Gold Loan Software
    • About Us
    • Contact
    • Terms and Conditions
    • Privacy Policy
    ISO27001:2022
    Certified

    © 2026 CloudHouse Technologies Pvt.Ltd. All rights reserved.

    Back to top