We can find the index of the first occurrence of a given substring in MySQL using the INSTR() function as follows.
INSTR()
SELECT instr(\'Have_a_good_da
If you don't want the overhead of REVERSE use the following:
LEFT ( 'Have_a_good_day', LENGTH('Have_a_good_day') - LENGTH(SUBSTRING_INDEX('Have_a_good_day','_',-1))-1 )