jyhqp

Registered
Apr 21, 2013
2
0
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!
 

arunsv84

Well-Known Member
Oct 20, 2008
372
1
68
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.

cp -rp /etc/my.cnf /etc/my.cnf.bakup
3. Now edit the Config file and modify it according to your requirement.

vi /etc/my.cnf
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.

/scripts/restartsrv mysql
Thanks!
 

jyhqp

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

1.jpg2.jpg

- - - Updated - - -

Can anyone help me?
 

arunsv84

Well-Known Member
Oct 20, 2008
372
1
68
127.0.0.1
cPanel Access Level
Root Administrator
Hi arunsv84 , I done what you said,but could not see the max_allowed_packet. As follow:

View attachment 15411View attachment 15421

- - - Updated - - -

Can anyone help me?
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.
 

wipes

Registered
Sep 13, 2013
1
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!
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.
 

Sys Admin

Well-Known Member
Apr 29, 2007
67
0
156
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.
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