So I have a box that includes a mysqldump file executed at provision. The problem now is that I need to increase the max_allowed_packet variable before execute this script.
How can I do something like:
max_allowed_packet = 128M >> /etc/my.cnf
but rather than at the EOF do it after the [mysqld]
section
Thank you
With GNU sed:
sed -i 's|\[mysqld\]|&\nmax_allowed_packet = 128M|' /etc/my.cnf
-i
: edit file "in place"
&
: refer to that portion which matched
\n
: new line