The attacker, who carried out a stabbing spree at the central railway station in Germany's second-biggest city, has been arrested.