The Second Republic lasted from October 1979 to 31st December 1983 when the government of Gen. Muhammadu Buhari took over through another military coup.
Thus, the Buhari/Idiagbon regime lasted until 27th, August 1985 when Gen. Ibrahim Badamosi Babangida and Augustus Ikhomoh ousted Buhari out of power.
However, the government of Babangida lasted from 1985 to 1993 when Nigeria witnessed very serious political crises and that led to the formation of an Interim Government headed by Ernest Shenikan.
The Interim Government did not last long as Gen. Sani Abacha took over from Shenikan after about three months.
However, the death of Sani Abacha in 1998 paved the way for Gen. Abdulsalami Abubakar as the last military Head of the State of Nigeria. It was under the government of Abubakar that the general election of 1999 was conducted.
And thus, the election brought the democratic government of Chief Olusegun Obasanjo of PDP to power. Hence Obasanjo was sworn in on May 29, 1999.