I have the same problem as this when I want to index a very large table on one of its non-unique columns which is an integer, and I tried all the solutions that are proposed in that post that has at least one vote up. I still couldn't fix it. Any other ideas?
I have enough memory:
max_allowed_packet: 2G, innodb_buffer_pool_size: 9G
All the time out settings mentioned in this post and here are set to much higher numbers than the default.