How to change max_allowed_packet value in mysql?
If you set it in the cnf(it may be my.ini file) you will likely need to restart the server. Optionally, that is a dynamic variable and can be SET GLOBAL or SET SESSION from the command line as well.So just do as follows.
mysql>show variables like’max_allowed_packet’;
mysql>set global max_allowed_packet=67108864;
mysql>exit;
Note: If you don't use global or use session,after execute exit command,max_allowed_packet value will be still 1048576.
Ïà¹ØÎĵµ£º
my.cnf »òÕßÊÇ my.ini
ÔÚ[MySQL(ºÍPHP´îÅäÖ®×î¼Ñ×éºÏ)d]ÅäÖöÎÌí¼Ó£º
max_connections = 1000
±£´æ£¬ÖØÆôMySQL(ºÍPHP´îÅäÖ®×î¼Ñ×éºÏ)·þÎñ¡£
È»ºóÓÃÃüÁ
MySQL(ºÍPHP´îÅäÖ®×î¼Ñ×éºÏ)admin -uroot -p variables
ÊäÈërootÊý¾Ý¿âÕ˺ŵÄÃÜÂëºó¿É¿´µ½
| max_connections | 1000 |
Æô¶¯mysql·þÎñ
RedHat ......
mysql ´ó¶ÔÏó´æÈ¡:
ÀàÐÍÒ»°ãÓ¦¸ÃÓÃmediumblod,
blobÖ»ÄÜ´æ2µÄ16´Î·½¸öbyte,
mediumblodÊÇ24´Î·½,
Ò»°ãÀ´Ëµ¹»ÓÃÁË.longblobÊÇ32´Î·½ÓÐЩ´ó.
MYSQLĬÈÏÅäÖÃÖ»ÄÜ´æ1M´óСµÄÎļþ,ÒªÐÞ¸ÄÅäÖÃ,WIN°æ±¾µÄÔÚmysql.iniÎļþÖÐ
ÐÞ¸Ämax_allowed_packet,net_buffer_lengthµÈ¼¸¸ö²ÎÊý,»òÖ±½ÓSET GLOBAL varName=value.
linux°æ± ......
Á˽âÁËһЩ×î»ù±¾µÄ²Ù×÷ÃüÁîºó£¬ÎÒÃÇÔÙÀ´Ñ§Ï°ÈçºÎ´´½¨Ò»¸öÊý¾Ý¿âºÍÊý¾Ý¿â±í¡£
¡¡¡¡1¡¢Ê¹ÓÃSHOWÓï¾äÕÒ³öÔÚ·þÎñÆ÷Éϵ±Ç°´æÔÚʲôÊý¾Ý¿â£º
mysql> SHOW DATABASES; +----------+
| Database | +----------+ | mysql |
| test | +----------+ 3 rows in set (0.00 sec)
¡¡¡¡2¡¢´´½¨Ò»¸öÊý¾Ý¿âabccs
¡¡¡¡mysql> ......
Ðè×¢ÒâÒÔÏÂÈýµã£º
1¡¢´´½¨Êý¾Ý¿âµÄʱºò£ºCREATE DATABASE `database`
CHARACTER SET 'utf8'
  ......
1.ÅäÖÃÃû×ÖΪmyodbcµÄÊý¾ÝÔ´
2.ÔÚstdafx.hÖмÓÉÏ
#import "c:\program files\common files\system\ado\msado15.dll" no_namespace rename ("EOF", "adoEOF")
3.ÔÚ³ÌÐò³õʼ»¯µÄ·½·¨ÖмÓÉÏ
AfxEnableControlContainer();
// ³õʼ»¯COM,´´½¨ADOÁ¬½ÓµÈ²Ù×÷
AfxOleInit();
4.ÔÚºÏÊʵĵط½¼ÓÉÏ
public:_ConnectionPt ......