Most commonly problem for beginners who have no more knowledge that how to handle a website with professional approach.
Almost beginners made the most tragic mistake on first stage, which is hosting should be secure and trustworthy. On internet online market now every third person offering hosting and doesn't caring about customer satisfaction, they all are money hunger.
Until your hosting secure, you can not stop hackers because until house main door will be open till that time robbers can come inside. So you should keep your house safe, that is your responsibility.
Same this strategy will be applied here, before purchase hosting you should care few things and that is also your responsibility because buyer is king forever. Read How To Choose Right Hosting Company?
Secondly, keep your password strong and random. Easy password can be cracked with little effort unlike strong password cannot be cracked or break. Review the below example of strong and weak passwords and analyze these examples itself.
Weak Password: John345
Strong Password: $J0Hn%E45&!
It is not an easy task to memorize complex passwords but as professional person you can do this. I would recommend you, to keep safe these password in notepad and then make locked zip file. Thus, no one cannot steal these passwords even he got access your computer
Both above reasons are prominent and vital to consider in future to avoid that kind of troubles.
Best of Luck!