Category: mysqlHow to edit my.cnf
ZENHOST Support Staff asked 11 years ago

It is not a file that you download and then upload again. Root-level files get changed via SSH.

There are two editors that are pre-installed on your server that you can use while you are SSH’ed in. They are called “nano” and “vi”. Of the two, nano will be easier to use, because its key combinations (menu) are provided right on the screen as you work.

 

To edit a file, first make a back-up.

cp /etc/my.cnf /etc/my.cnf.old

Now open it in nano:

nano /etc/my.cnf

Use the arrows to navigate around. Or:

  • CTRL-W brings up a search box, type in the value you are looking for and hit enter.
  • CTRL-V is page down
  • CTRL-Y is page up
  • CTRL-K deletes the line the cursor is on
  • CTRL-X to exit…
  • if you want to save the changes you have made, hit Y. If you don’t want to save your changes (like if you made a dastardly mistake, which I do often) hit N. You can always go back into nano again and re-try at making the changes correctly.

 

Once you are done,

/etc/rc.d/init.d/mysql restart

Your changes will now take effect.