The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to edit the my.cnf

Discussion in 'Database Discussions' started by jyhqp, Apr 21, 2013.

  1. jyhqp

    jyhqp Registered

    Joined:
    Apr 21, 2013
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Due to the default value of variable max_allowed_packet is 1M,I tried to import SQL files to my database but failed. It seems it is read-only in current version. I searched the solution in google and people said I must update it in my.ini.Can anyone tell me how to do this? As detailedly as possible,I am a layman to Linux. Thank you very much!
     
  2. arunsv84

    arunsv84 Well-Known Member

    Joined:
    Oct 20, 2008
    Messages:
    373
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    127.0.0.1
    cPanel Access Level:
    Root Administrator
    1. Login to server via ssh (Use a client like putty if you are on a windows machine)

    Putty Download

    Steps to Login using Putty

    2. Backup the existing my.cnf file using the following command.

    3. Now edit the Config file and modify it according to your requirement.

    Search for max_allowed_packet in the above file.

    Edit the required value. Something higher like 16M or 32M.

    Save and quit. (To save and quit using vi editor, press [Esc] key and then : (the colon). For example, to exit from vi saving changes, press [Esc], : (colon) and type wq )

    4. Restart MySQL using the following command.

    Thanks!
     
  3. jyhqp

    jyhqp Registered

    Joined:
    Apr 21, 2013
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi arunsv84 , I done what you said,but could not see the max_allowed_packet. As follow:

    1.jpg 2.jpg

    - - - Updated - - -

    Can anyone help me?
     
  4. arunsv84

    arunsv84 Well-Known Member

    Joined:
    Oct 20, 2008
    Messages:
    373
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    127.0.0.1
    cPanel Access Level:
    Root Administrator
    Yes. I have checked your screenshot and its not set on your my.cnf. If you wish to set some particular value just set it as mentioned before and restart MySQL.
     
  5. wipes

    wipes Registered

    Joined:
    Sep 13, 2013
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi I have one question for you. I see how to do a back up for the my.cnf file, but what is the command to restore the my.cnf file if I need to. Thanks you in advance.
     
  6. Sys Admin

    Sys Admin Well-Known Member

    Joined:
    Apr 29, 2007
    Messages:
    67
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    You can just cp the backed up file back to it's original place using the below command then restart the mysql server.

    cp -af /etc/my.cnf.bakup /etc/my.cnf
     
Loading...

Share This Page