我有一个大尺寸数组,我想将其直接保存在 mysql 数据库中。在保存之前,我使用 json_encode 对数组进行编码,但是每当我尝试保存数据时,就会出现错误。
CDbCommand failed to execute the SQL statement: SQLSTATE[08S01]: Communication link failure: 1153 Got a packet bigger than 'max_allowed_packet' bytes.
我增加了/etc/my.cnf 中的 max_allowed_packet 值并重新启动了 MySQL 服务,但这不起作用!!
最佳答案
max_allowed _packet
和 net_buffer_length
更改为
max_allowed_packet='required size'
net_buffer_length='required size'
关于php - 使用 PHP (json_encode) 将数组保存在 mysql 数据库中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39291425/