![]() |
|
Guide CyberPanel Optimize MySQL: What the One-Click Tuner Changes - Printable Version +- AdminsForum (https://adminsforum.com) +-- Forum: Free & open-source control panels (https://adminsforum.com/Forum-free-open-source-control-panels) +--- Forum: CyberPanel (https://adminsforum.com/Forum-cyberpanel) +---- Forum: CyberPanel Guides & Tutorials (https://adminsforum.com/Forum-cyberpanel-guides-tutorials) +----- Forum: CyberPanel Databases & phpMyAdmin Guides (https://adminsforum.com/Forum-cyberpanel-databases-phpmyadmin-guides) +----- Thread: Guide CyberPanel Optimize MySQL: What the One-Click Tuner Changes (/Thread-guide-cyberpanel-optimize-mysql-what-the-one-click-tuner-changes) |
CyberPanel Optimize MySQL: What the One-Click Tuner Changes - JAY - 11-14-2026 CyberPanel Optimize MySQL: What the One-Click Tuner Changes (Tested) A fresh CyberPanel server runs its database (MariaDB) with small default settings, whatever the size of your server. CyberPanel has a built-in Optimize MySQL page that writes a new config based on your RAM. We ran it on a CyberPanel 3.0.8 server (Ubuntu 24.04, MariaDB 10.11, 8 GB RAM, 4 CPU cores) and checked every setting before and after. It works, but it also quietly switches off MariaDB's strict mode and sets the slow query log to a threshold that's too high to be useful. Here's the full picture. Step 1: Look at what you have now Over SSH as root. These lines read CyberPanel's database password from its own file, so you don't need to know it: Code: PASSWORD=$(cat /etc/cyberpanel/mysqlPassword)
mysql -uroot -p"$PASSWORD" -e "SHOW GLOBAL VARIABLES WHERE Variable_name IN ('innodb_buffer_pool_size','tmp_table_size','max_connections','slow_query_log','long_query_time','sql_mode');"
mysql -uroot -p"$PASSWORD" -e "SHOW GLOBAL STATUS WHERE Variable_name IN ('Max_used_connections','Created_tmp_tables','Created_tmp_disk_tables','Slow_queries');"
Step 2: Back up the config The panel page says it itself: back up first. One command: Code: mkdir -p /root/mysql-backup && cp -a /etc/mysql/mariadb.cnf /etc/mysql/mariadb.conf.d/50-server.cnf /root/mysql-backup/Step 3: Generate the suggestion Open Code: https://YOUR-SERVER-IP:8090/dataBases/OptimizeMySQLClick Generate Recommendations. Nothing changes yet. The left box shows your current config, the right box the suggested one. For our 8 GB server it suggested, among other things: Code: max-connections = 500
tmp-table-size = 32M
max-heap-table-size = 32M
innodb-log-file-size = 128M
innodb-buffer-pool-size = 1228M
slow-query-log = 1
long_query_time = 30
sql-mode = NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USERStep 4: Apply and restart Click Apply Changes (we got Changes successfully applied), then Restart MySQL. The restart took a few seconds. Our sites answered normally afterwards, and the new values were live: Code: before after
innodb_buffer_pool_size 128 MB 1228 MB
tmp_table_size 16 MB 32 MB
max_connections 151 500
innodb_log_file_size 96 MB 128 MB
slow_query_log OFF ON
long_query_time 10 s 30 sWhat it changes that you might not expect
Step 5: Make the slow query log useful The tool turns the slow query log on, but only for queries that take 30 seconds. Almost nothing is that slow, so the log stays empty while your site may still feel sluggish. We lowered it to 2 seconds: Code: sed -i "s/^long_query_time.*/long_query_time = 2/" /etc/mysql/my.cnf
systemctl restart mariadbCode: mysql -uroot -p"$PASSWORD" -e "SELECT SLEEP(3);"
tail /var/lib/mysql/*-slow.logCode: # Query_time: 3.000337 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 0
SELECT SLEEP(3);Code: /var/lib/mysql/Code: HOSTNAME-slow.logIf something goes wrong If MariaDB doesn't start after a change, put the original link back and restart: Code: ln -sf mariadb.cnf /etc/mysql/my.cnf
systemctl restart mariadb
journalctl -u mariadb --since "-10 min" | tail -30Does it make your sites faster? Honest answer: on our test server we couldn't measure a difference, because our databases are tiny (about 7 MB in total) and already fit in the old 128 MB pool. The tool matters when your databases are bigger than the buffer pool: check your total size with Code: mysql -uroot -p"$PASSWORD" -e "SELECT ROUND(SUM(data_length+index_length)/1024/1024) AS total_mb FROM information_schema.tables;"Run the tuner on your server? Post your before and after values below (hide your server IP first). |