It was an inauguration of fire for Mr Mubarak, who as vice-president was sitting beside Sadat, directly in the line of fire. The assault gave him first-hand experience - he was hit in the wrist - of the violent ruthlessness of the Islamic extremists.
Today Mr Mubarak is set to be reconfirmed as President for a third six-year term. This is not a presidential election, but a referendum on his nomination as sole candidate. His nomination received 439 of the 448 votes in parliament on 21 July. The only interest to the authorities is the extent of public apathy in such an electoral sham. The only interest to the public is the depth of official dishonesty when they declare the results.
On the eve of the referendum, Mr Mubarak said there would be greater democracy in Egypt if people united to defeat the current of violence. 'We still hope to strengthen Egyptian democracy so that Egypt can be a model and example to others,' he said.
In Egypt, however, officials often confuse democracy, or popular participation in the decision-making process, which is very limited, with freedom of expression, which has increased greatly under Mr Mubarak's rule.
Mr Mubarak begins his third term in circumstances which bear some striking resemblances to that fateful time 12 years ago. The authorities are locked in a violent struggle with extremist groups fighting under the banner of Islam. More than 250 people have been killed in clashes in the past year. Thousands of suspects have been detained. More than a dozen have been hanged. And the economy still labours under the same weaknesses that each year for the past two decades have prompted, from the World Bank and IMF, calls for urgent reform.
Twelve years ago the recently widowed Mrs Sadat turned to her husband's successor with the words 'Imsik il-balad' (grab hold of the country), but Mr Mubarak has failed to do so. Yet the burden he inherited, the crushing poverty of the majority, the exploding population, and the inflexibility of the bureaucracy are problems which no ruler of Egypt could defeat, only contain.
But in some areas the situation has worsened. The national debt has increased under Mr Mubarak.
Corruption, even at the highest levels, is as widespread as it was in the latter part of the Sadat era. The population, now 57 million, continues to rise inexorably by a million or more a year, creating demand for more houses, hospitals, jobs and schools.
There have been some encouraging economic signs. Liberalisation has continued, the pound was floated, the budget deficit is down, and foreign currency reserves are up, despite the severe drop in revenue from tourists.
But the reformers are calling for more. They want further privatisation of the bloated public sector industries. Mr Mubarak has put the brakes on, anxious at social unrest as jobs are savagely cut.
The greatest challenge to the government is the Islamic militants centred on what are known as the Gamaat al-Islamiya or the Islamic groups. They have targeted members of the security forces, but have hit tourists.
The Islamic groups however do not pose a threat to the stability of the regime. They are not powerful enough to make a push for power.
But the groups can be very disruptive of Mr Mubarak's reforms. They have thrived on social injustice in a country where the gap between rich and poor is widening. The disillusionment of an entire generation has been fuelled by policies which tolerate high-level corruption.
Mr Mubarak's first task should be to prepare for the succession. In 12 years he has failed to find anyone he considers sufficiently qualified to be his vice-president. Already, the country is in need of fresh ideas, and a new man at the top. Someone to whom he can turn and say 'Imsik il-balad'.