There are several questions about getting hand cramps while playing guitar, but I didn't find one on bass. My left hand cramped up midway through the gig last night. I have another gig that's twice as long next week and am worried it will happen again. What are the most common causes of hand cramps on bass? Maybe I was just fretting too vigorously? Or maybe I need more Gatorade (it was a warm night after all)?
I play bass on average 2 to 4 hours at a time. 2 to 3 nights a week. I'm 65 yr old and have a small hand for an adult. But, the thing that keeps my hand from cramping too much is not trying to play like a rocker who has the neck of the bass by his or her hip. Playing cool looking is both bad for you hand and wrist and for your posture. I play with the neck in as close a position up my body as needed to allow comfortable wrist position. Little bend in wrist and hand around the neck. And very important don't over press the strings into the neck. You will be surprised how fast you can play and how smooth the sound with less pressure.
As well as b3ko's advice on hydration and nutrition, pay attention to your posture and the way your instrument is strapped. Having the nut end of the neck too far away from your body, or (as Richard Terry says) too low, can increase the strain on your hand, as can having to hold up the bass with your left hand to counter neck dive.
The easiest bass posture I've achieved is by playing a short scale bass, and strapping it Skip Battin style at the headstock. It doesn't look very cool but you can compensate for that by just being cooler yourself.
The crucial thing to keep in mind to avoid hand-cramps is that the hand shouldn't actually be what does the work of pushing down the strings. The fingers mostly just transmit the force that, with the right technique, the arm supplies. (Both the muscles and the sheer weight of it.) For this to work, you must have your wrist reasonably straight, so that the sinews can properly get that force to where it's needed.
To practise that, I recommend playing a bit in classical-guitar or even cello position: sitting, instrument between the legs with neck pointing mostly upwards. Then you can just “hook” your fingers on the neck on a string and thus push it down on the fretboard without actively supplying any force at all.
When standing on stage with non-silly strap position, you won't be able to make as much use of the weight anymore, but you can still implement the basic principle.
In addition to the great answers here, have you tried any hand and shoulder stretches prior to playing? Gentle stretching at the wrists, at the elbows, while gently opening yourself at the shoulders.
It feels good (to me) and has resolved the problems I had with cramping while playing. It also helped me to build up to hours of playing time. The one other thing that really helped was to use minimum pressure when playing. That is true for my guitar and bass playing.
Hope that helps in some way for you too !