The steering mechanism of ship steering gear is generally driven by a hydraulic system. The precise control of the hydraulic cylinder in the steering mechanism can be achieved by the target rudder angle. However, hydraulic systems are often described as nonlinear systems with uncertainties. Since the system parameters are uncertain and system performances are influenced by disturbances and noises, the robustness cannot be satisfied by approximating the nonlinear theory by a linear theory. In this paper, a learning-based model predictive controller (LB-MPC) is designed for the position control of an electro-hydraulic cylinder system. In order to reduce the influence of uncertainty of the hydraulic system caused by the model mismatch, the Gaussian process (GP) is adopted, and also the real-time input and output data are used to improve the model. A comparative simulation of GP-MPC and MPC is performed assuming that the interference and uncertainty terms are bounded. Consequently, the proposed control strategy can effectively improve the piston position quickly and precisely with multiple constraint conditions.