关于更改mysql的max_allowed_packet
变量,有很多问题。到目前为止给出的建议都没有帮助我。我在OSX 10.10.4上,并在〜/ .my.cnf
[mysqld]
user = root
password = redacted
general_log=1
log=/var/log/mysql-query.log
max_allowed_packet = 32M
[mysqldump]
max_allowed_packet = 32M
user = root
password = redacted
[mysql]
max_allowed_packet = 32M
我停止服务并确保它已停止。然后我重新启动服务并查询:
SHOW VARIABLES LIKE '%max_allowed_packet%';
这给了我同样的东西:
Variable_name Value
max_allowed_packet 1048576
slave_max_allowed_packet 1073741824
我正在运行MySQL 5.5.29,并且在这些地方没有其他配置文件:
/etc/my.cnf
/etc/mysql/my.cnf
/usr/local/mysql/etc/my.cnf
任何有助于提高我的1M限制的帮助都将受到极大的赞赏和赞成。
答案 0 :(得分:1)
希望我能等待一个不那么激烈的解决方案,但我不得不放弃本机包安装版本。在备份了我的所有数据库后,我转而使用了酿造版本:
sudo /usr/local/mysql/support-files/mysql.server stop
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
sudo rm /Library/LaunchDaemons/com.mysql.mysql.plist
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/*mysql*
sudo rm -rf /var/db/receipts/com.mysql.*
brew install -v mysql
cp -v $(brew --prefix mysql)/support-files/my-default.cnf $(brew --prefix)/etc/my.cnf
cat >> $(brew --prefix)/etc/my.cnf <<'EOF'
# my changes
max_allowed_packet = 32M
innodb_file_per_table = 1
EOF
sed -i '' 's/^#[[:space:]]*\(innodb_buffer_pool_size\)/\1/' $(brew --prefix)/etc/my.cnf
brew services start mysql
$(brew --prefix mysql)/bin/mysql_secure_installation