At least version 5.6.14 of the client has the --sigint-ignore option to totally ignore the SIGINT handler. It appears to have been added on Oct 7th, 2004 -- so it's been around a while at least. I just tested it, and it does keep CTRL-C from cancelling the MySQL client. However, it would be nice if CTRL-C would also cancel the current command line buffer like it does on the BASH shell -- as the PostgreSQL CLI does. I've forked MySQL in order to see how hard it would be to implement some such thing. I'll post a Homebrew formula with a tarball link when/if it's ready.
Ever have one of those days? I created the promised patch, and then I decided to create a video to demonstrate it. It worked! However, I couldn't disable it! Well, it turns out that MySQL actually baked in the functionality to the core client last year! Yep, the A to this Q is to download at least MySQL 5.7.3-794-g901d27f's client. It has the functionality we all desired.
From the command line just add the --sigint-ignore flag:
mysql --host=127.0.0.1 --port=8900 --user=root -p --sigint-ignore DBNAME
Or, do like I did and create a MySQL config file for your user account at
%USERPROFILE%/.my.cnf on Windows) with the following content:
This will ensure that all
mysql executions ignore the annoying Ctrl-C and behave like a good SQL client.