How to edit the MySQL my.cnf file

If you have your VPS or Dedicated server, you can manage your MySQL settings into my.cnf file.This article will explain the steps to view and edit your my.cnf file.

1- To view your MySQL settings into my.cnf file:

Login to your server via ssh

To view the settings run the following command:

cat /etc/my.cnf

The content of my.cnf file will be displayed.

2- To edit MySQL my.cnf file:

login to your server via SSH

To edit the settings type the following command:

nano /etc/my.cnf

For example, if you want to edit the max_connections, Find the following line:


After editing save the settings and restart MySQL service:

service mysql restart