In this paper, by using the dynamic mesh technique and solving the unsteady RANS equation in conjunction with a RNG k-ε turbulence model, numerical simulation of the threedimensional unsteady viscous flow around a passing ship and a berthed ship in shallow water was conducted, and the hydrodynamic forces acting on the berthed ship were calculated. The proposed method was verified by comparing the numerical results with those of empirical formulae. The hydrodynamic forces acting on the passing ship were also calculated and compared with those on the berthed ship. Finally, by analyzing the numerical results obtained at different water depths, lateral distances between the ships, berthed ship to bank distances and passing ship to bank distances, the influences of these factors on the hydrodynamic forces of the berthed ship were illustrated.