Every port is competing for attracting loyal customers from other ports to achieve more profits stably. This paper proposes a data-mining scheme to facilitate this process. For resolving the problem, the OD (Origination-Destination) data are gathered from the AIS (Automatic Identification System) data. The OD data are clustered according to the arrival dates and ports. The FP-growth algorithm is applied to mine the frequent patterns of ships arriving at ports. Maintaining a loyal customer list for port updates and accuracy is critical in establishing its usefulness. These lists are critical as they can be used to provide suggestions for new products and services to loyal customers. Finally, based on the frequent patterns of the ships and the mode of arrival times, a formula proposed in this paper to derive shipping companies’ loyalty to ports was applied. The case of Kaohsiung port was shown as an example of our algorithm, and the OD data of ships in 2017-2018 were processed. Using the results of our algorithm, other rival ports, such as Shanghai or Busan, may attract customers no longer loyal to Kaohsiung ports in the last two years and attract them as new loyal customers.