In 1987 the IMO (International Maritime Organization) introduced its ship identification system to improve maritime safety and to prevent maritime fraud. A unique reference number is assigned to each ship for identification purposes. It is assigned by IHS Maritime when constructed. That number is permanently associated to the hull, so it would never change regardless of a change in the ships name, owner or flag. The IMO number consists of the three letters "IMO" followed by a seven-digit number and is never reassigned to another ship.
The MMSI number (Maritime Mobile Service Identity) is a unique nine-digit number for identifying a ship. It is programmed into all AIS systems and VHF electronics on board of the vessel and provides an internationally standardized number for contacting the vessel. This number is assigned to a vessel not to an individual by the appropriate authorities in the country of registration of the vessel. All vessel MMSI numbers are using the format MIDXXXXXX. The first three digits are called MID (Maritime Identification Digits) and representing the nationality (see the ITU Table of Maritime Identification Digits: https://www.itu.int/en/ITU-R/terrestrial/fmd/Pages/mid.aspx). The last six digits are used for the unique identification of the vessel.
Please note: The AIS system is using the MMSI, not the IMO number, to identify a vessel. The IMO number is part of the static AIS information provided by the vessels crew and can be transmitted additionally. So it could happen if you are searching a vessel in the FleetMon vessel database by its IMO number that you find more than one entry because the vessel had different MMSI numbers in the past. In some cases, it is possible that the MMSI number of a vessel changes, e.g. the vessel is sold or long-term chartered and the flag changes. Then the MMSI will change as well because the vessel needs another MID. In the vessel database, you will find the same vessel with its different MMSI numbers then.