The easiest way to do this is to store each component of the name in a separate field (last name, first name, middle initial) in MySQL and avoid concatenating in database queries.
This way you don't have to think about names with multiple words, especially if there are patterns (like two-word surnames)