How to change max_allowed_packet size

后端 未结 12 1822
星月不相逢
星月不相逢 2020-11-22 09:16

I am having a problem with BLOB fields in my MySQL database - when uploading files larger than approx 1MB I get an error Packets larger than max_allowed_packet are not

12条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-22 09:28

    For those running wamp mysql server

    Wamp tray Icon -> MySql -> my.ini

    [wampmysqld]
    port        = 3306
    socket      = /tmp/mysql.sock
    key_buffer_size = 16M
    max_allowed_packet = 16M        // --> changing this wont solve
    sort_buffer_size = 512K
    

    Scroll down to the end until u find

    [mysqld]
    port=3306
    explicit_defaults_for_timestamp = TRUE
    

    Add the line of packet_size in between

    [mysqld]
    port=3306
    max_allowed_packet = 16M
    explicit_defaults_for_timestamp = TRUE
    

    Check whether it worked with this query

    Select @@global.max_allowed_packet;
    

提交回复
热议问题