The mysql client will exit if 'setupterm()' fails, e.g. if the 'TERM' environment variable is not recognized by curses.
To reproduce, use TERM=asdf mysql on a client binary built with curses support (the default).
The client will quit with:
'asdf': unknown terminal type.
The attached patch will fallback to the non-curses path if setupterm() fails.