It heavily depends on the day of the week you are looking at, some trains passing by 5 Terre are suspended during weekends and holidays because, hey, it's the period they are most needed...welcome to Italy!
So, for example, the Regionale 11291 suggested by Enrico is not operating on Saturdays and Sundays.
On top of that take into account that in June the timetables will change, and it's not granted that Trenitalia website will be fully sync'd to the real timetables for a few days.
- search on the site for the exact day you plan to go, otherwise you could get some nasty surprise.
- if you plan to travel after 14/07/2017, wait a few days after that date to check for the new timing table
- never ever trust any site other than the official one, and use only the home page timetable search. Official time tables can and are changed frequently according to maintenance works on the lines, and maintenances are not planned a year in advance so to have officially printed or pdf-ed timetables always be updated (and this is normal for almost any train company). So if you resort to some third party website or a pdf, you run a good risk to rely on an obsolete information. The good news is that Trenitalia site was a scam 'till some months ago tricking tourists to buy highly expensive tickets, but after a few years of complains it's been finally fixed and now you don't run that risk anymore, so use it :-)
A small update, as I was reading the other answers again: do not rely on ticket offices. They can be totally missing, they can be present and closed, and they can be present with only the automatic machine, which is more often than not broken or not getting card when you don't have coins or not getting coins when you have only them. As tickets last for 24 hours, always buy in the morning all the tickets you need during the day at either La Spezia or Genova.