Skip to content
  • About
  • Contact
  • Docs
  • Features
  • Home

Configurations

5
  • Setup RAID Level 6
  • Setup RAID Level 5
  • How To Add Swap on RHEL or Centos based system
  • Website Migration to Non-Panel OpenLiteSpeed Server
  • Linux Server Performance Tuning

CyberPanel

9
  • Mounting /tmp on a Separate File
  • Updating CyberPanel Main VirtualHost Configuration
  • Updating CyberPanel vHosts Configuration
  • How to Change CLI PHP on CyberPanel
  • How to Update PHP Version to 8.1 in CyberPanel (From 7.3, 7.4, or 8.0)
  • CyberPanel Server Cleanup: Logs, Dumps, Backups
  • CyberPanel Full LSPHP Installation PHP 7.4 – 8.3
  • CyberPanel / OpenLiteSpeed: Clean LSPHP Session Files
  • SSL Certificate Management in CyberPanel via SSH

Hestia Control Panel

6
  • Fixing Email Bounce Back Issue in Hestia (Exim4 Blacklist Rejection)
  • Managing Fail2Ban in HestiaCP Server
  • Installing and Configuring PHP Versions in HestiaCP
  • phpMyAdmin Not Found in HestiaCP
  • Setting Up a Reverse Proxy for any Port in HestiaCP
  • How to Install Let’s Encrypt SSL in Hestia CP (Hostname, Admin Panel, and Email Server)

WHM/cPanel

6
  • Setting Up a Reverse Proxy on cPanel/WHM for Port 8081
  • How to increase the size of the cPanel-generated /tmp filesystem
  • Installing Old PHP Versions on a cPanel/WHM Server
  • Fixing “550: Your Country is Not Allowed to Connect to This Server” Error in Exim (cPanel)
  • Enable WP-CLI in CageFS on CloudLinux Servers (WHM/cPanel)
  • Securing /tmp and /var/tmp with a Dedicated Loopback Filesystem

Nagios

5
  • Service Checks
  • Uptime Checks
  • Disk Space Checks
  • Load Checks
  • Email Related Checks

WordPress

3
  • WordPress Core Reinstallation Guide
  • Managing WordPress Users via WP-CLI
  • Website Duplication, Migration, or Domain Change

Operating System

1
  • Server Reboot (RHEL or Centos based system)

AWS

1
  • How to Resize EBS Volumes on AWS

Databases

2
  • MySQL
    • Optimizing MySQL Performance
    • Recovering MySQL in Plesk When InnoDB Crashes

CloudLinux

4
  • Moving cagefs-skeleton directory
  • Enable WP-CLI in CageFS on CloudLinux Servers (WHM/cPanel)
  • Enable bc in CageFS on CloudLinux Servers(WHM/cPanel)
  • How to Upgrade MySQL 5.x to MySQL 8.0 on CloudLinux (WHM server) with MySQL Governor

Cloudflare

1
  • Configuring Security Headers in Cloudflare

ISPmanager

1
  • Install Free SSL (Let’s Encrypt) for domain.tld on ISPmanager with NGINX

Plesk

1
  • Plesk Admin Login Blocked – IP Restriction Recovery Guide

VPN

4
  • Install OpenVPN Open Source in Linux CentOS Ubuntu Debian Servers
  • Protected: OpenVPN Installation & Fix Wiki (CloudLinux / CentOS 7 & 8)
  • Outline VPN Installation & Management Guide
  • Installing AdGuard Home on Debian/Ubuntu (Docker)
View Categories
  • Home
  • Docs
  • Databases
  • MySQL
  • Optimizing MySQL Performance

Optimizing MySQL Performance

Optimizing MySQL Performance Using MySQLTuner/Primer Script

MySQLTuner and Primer  is a script that evaluates your MySQL database performance and provides recommendations for improvements. Follow this guide to analyze and optimize your MySQL configuration.

1. Check System Resource Usage

Before tuning MySQL, check how system resources (RAM and CPU) are being utilized:

echo [PID] [MEM] [PATH] && ps aux | awk '{print $2, $4, $11}' | sort -k2rn | head -n 20

ps -eo pcpu,pid,user,args | sort -k 1 -r | head -20
2. Install and Run MySQLTuner

🔹 Download MySQLTuner

wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl

🔹 Make MySQLTuner Executable

chmod +x mysqltuner.pl

🔹 Run MySQLTuner
Execute the script and enter your MySQL root credentials when prompted:

./mysqltuner.pl

🔹 Sample Output

>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with ‘–help’ for additional options and output filtering
Please enter your MySQL administrative login: root
Please enter your MySQL administrative password:
[OK] Currently running supported MySQL version 5.5.41
[OK] Operating on 64-bit architecture
[!!] Query cache efficiency: 0.0% (0 cached / 71 selects)
[!!] Total fragmented tables: 11
[OK] Slow queries: 0% (0/113)
[OK] InnoDB buffer pool / data size: 128.0M/1.2M

——– Recommendations —————————————————–
General recommendations:
– Run OPTIMIZE TABLE to defragment tables for better performance
– Enable the slow query log to troubleshoot bad queries
Variables to adjust:
– query_cache_limit (> 1M, or use smaller result sets)

MySQLTuner will provide performance suggestions based on your current configuration.

3. Alternative: Tuning Primer Script

If MySQLTuner does not run properly, use the Tuning Primer  script as an alternative.

🔹 Download Tuning Primer

wget https://launchpad.net/mysql-tuning-primer/trunk/1.6-r1/+download/tuning-primer.sh

🔹 Make Tuning Primer Executable

chmod +x tuning-primer.sh

🔹 Run Tuning Primer

./tuning-primer.sh

This script will analyze your MySQL performance and suggest changes.

4. Tuning MySQL Configuration

The MySQL configuration file is located at:

/etc/mysql/my.cnf

🔹 Backup the MySQL Configuration

Before making changes, create a backup:

cp /etc/mysql/my.cnf ~/my.cnf.backup

🔹 Apply Changes

Edit `/etc/mysql/my.cnf` and modify recommended variables. Make sure lines are not commented out with `#`.

🔹 Restart MySQL After Changes

For systemd-based systems:

systemctl restart mysqld

For other init-based systems:

service mysql restart

🔹 Monitor Performance
After making changes, rerun MySQLTuner or Tuning Primer to check if further optimizations are needed.

Conclusion

Using  MySQLTuner  and Tuning Primer , you can optimize MySQL performance safely. Always make incremental changes  and monitor performance after each modification..

Table of Contents
  • 1. Check System Resource Usage
  • 2. Install and Run MySQLTuner
  • 3. Alternative: Tuning Primer Script
  • 4. Tuning MySQL Configuration
  • Conclusion

Share This Article :

  • Facebook
  • X
  • LinkedIn
  • Pinterest

Was it helpful ?

  • Happy
  • Normal
  • Sad
  • About
  • Contact
  • Docs
  • Features
  • Home

© 2026 Panel Web Hosting

  • About
  • Contact
  • Docs
  • Features
  • Home