1. Firstly power off your console, using either the power button or by removing the power source.
2. To turn on the PS4 into Safe mode, Press and Hold down the power button on the front of the PS4, until the console beeps twice (once immediately, then another after a few seconds of holding)
3. Connect your Dual Shock remote via USB cable.
4. Press the PS button on the controller to pair devices.
The console will now be in Safe Mode
1. Go to option "5. Rebuild Database" and press X
2. "The database will be rebuilt, it might take a few hours to rebuild the database" will be displayed, Select OK.
3. The screen will go blank whilst the Database is being rebuilt and this could take a few hours depending on the amount of saved content.
4. When the Rebuild has finished the console will return to the sign in screen.
The rebuild is now complete. None of your installed games or features will be affected, but inside your Database and memory will now be a lot cleaner.