linux comment line which start with some string

sed s/^character-set-server=utf8/#character-set-server=utf8/’ -i /etc/my.cnf

If you want comment on this this line “character-set-server=utf8” on all your servers, you should use something like ansible:

ansible mysql_servers -m shell -a “sed -e ‘s/^character-set-server=utf8/#character-set-server=utf8/’ -i /etc/my.cnf”

Leave a Reply

Your email address will not be published. Required fields are marked *