This issue is likely caused by using illegal or incompatible software, which are known to corrupt your hosts list by redirecting any Mojang authentification server address to their own illicit servers. To fix this, you need to remove any non-official software, then you need to fix your affected hosts file by doing the following:
- Go to the Start Menu and locate notepad. Right click notepad and select Run as Administrator
- Press Ctrl and O on your keyboard, then enter %SystemRoot%\System32\drivers\etc\hosts as the "File name" and press "Open"
- Remove every line mentioning "Mojang" and hit save (Ctrl+S). (Example: https://imgur.com/qBb9vZA)
On Linux and possibly MacOS
Your user needs to be a sudoer (have administrative privileges), otherwise you need to log as the superuser if you know the password or ask assistance to your system administrator.
- Open a terminal application (search for terminal in your application launcher).
- Type sudo nano /etc/hosts
- Remove any line containing "Mojang" then save the hosts file.
You should now be able to play Minecraft again, please never use any illegal tools or accounts.
It is highly recommended to sign in and change your password.
If your hosts file does not contain any line mentioning a Mojang server or you are still experiencing this issue, please contact 💬 Community Support. Please don't post comments here if you don't have any new insights to share, this is not a support forum.
You can also check
MCL-5546 for more detailed instructions on how to properly uninstall incompatible software.