MySQL server comes with a default configuration that is suitable for most small websites. But for large websites, you may be using lower resources than you have, which may result in a slow website.
Just follow commands below to get some idea on how you can optimize your mySQL configuration.
To analyze system and get recommendations, we will be using mySQLtuner perl script.
Step1: Downloading and making script executable
cd ~ wget mysqltuner.pl mv index.html mysqltuner.pl chmod +x mysqltuner.pl
Step2: Running tuner script and modifying your configuration file
./mysqltuner.pl nano /etc/my.cnf
Step3: Restarting your mysql server (For CPanel Installations)
Step3: Restarting your mysql server (For general installations)
service mysqld restart
You may need to repeat steps 2 and 3 a few times to find your best configuration results. Here is what my final configuration looks like: