I ran into this problem with the Zero (non-BC) client files. `std::bad_alloc` is a general libstdc++ error that indicates the pointer tried to allocate new[] beyond usable system memory. Turns out I was using a VM that had only 2GB allocated to it (!) so I upped it to 4GB and it succeeded. I would check to make sure something else on your system isn't hogging more available memory and try. I don't know what the bare minimum is but apparently 2GB is definitely not enough.
Actually the real issue is because MySQL 8 added a new reserved word called `GROUPS` which conflicts with the name of the table and the alter statements aren't properly qualified.
Simply add the backticks (`) around `groups` and the ALTER will succeed.
https://dev.mysql.com/doc/refman/8.0/en/keywords.html
(R); added in 8.0.2 (reserved)