TL; DR
No need to define a formatter at all.
LocalDateTime.parse(
"2017-11-21 18:11:14.05".replace( " " , "T" )
)
ISO 8601
Sleiman Jneidi's answer is especially smart and high-tech, but there is an easier way.
ISO 8601, , java.time. . ( ) () .
. SPACE T
.
String input = "2017-11-21 18:11:14.05".replace( " " , "T" );
LocalDateTime ldt = LocalDateTime.parse( input );
ldt.toString(): 2017-11-21T18: 11:14.050