⚠ Safety note: This guide involves working with electricity. If you're not completely sure about every step, stop and call a licensed professional. Before you start, always switch off the power at the breaker or close the main water/gas valve.
1 Prepare a safe work area
Switch off the correct breaker, tag it against accidental switch-on, and confirm the absence of voltage with a suitable two-pole tester before touching the conductors.

⚠ Warning: Mains voltage can be fatal. If you cannot reliably disconnect it and confirm the absence of voltage, if the conductor colors are unclear, or if the installation is damaged, do not continue on your own.
2 Determine the condition and cause
Check the weight of the light, the type of ceiling, and the load-bearing capacity of the existing bracket. The electrical cable must not carry the weight of the light fixture.
3 Carry out the key check
Identify the conductors by measurement, not just by color, and connect them with suitable certified terminal blocks inside the intended ceiling rose.
4 Carry out the repair or maintenance
Secure the bracket with anchors suitable for the ceiling material, connect the protective conductor where provided, and close all connections before testing.

? Tip: Take a photo of the starting state and change only one thing at a time. That makes it easier to see what actually fixed the problem.
5 Test the result
Put the covers and guards back before switching the power on. Test the function without touching exposed parts; heating, buzzing, sparking, or tripping the protection call for an electrician.

When to call a professional: If the job involves changes to the electrical panel, the main gas line, or load-bearing walls/beams — or if you're not sure how it will turn out — this is not a DIY task. Hire a licensed professional.