Securing MySQL given root access on a server

Let’s say a hacker gains root access to a server containing password protected MySQL.

Well, if we they simply reset the MySQL root password, given a few simple commands, doesn’t that defeat the point in having it password protected in the first place?

For example, is there a well-practised technique in which one can segregate MySQL and prevent such a thing from happening. The only thing I could think of was, perhaps, moving the database to a different server all together.

All thoughts welcome.


I understand that MySQL passwords allow for multiple accounts, with various permissions, and nothing more. My question is more focused on how to isolate the database, so if infiltrated one can’t simply dip into your database records.


Exposing root password to hacker is the worst thing that can happen to your server at all. If this occured on your production server, you shouldn’t care about your MySQL db, your should immidiately shut the server down or at least isolate it from network rather on physical layer. Then search signs of intrusion on other servers and determine the root cause. You should never use penetrated OS in production again. Hacker may leave backdoor, timebomb, spoof some binary file with his own etc, so even if you eliminated all visible consequence of intrusion, you are still in danger.
It is theoretically possible to protect something from root, but this absolutely wrong way in your case. You should focus on guaring root password – disallow root ssh logins, aviod running daemons with root privileges, if possible, chroot them etc.

Source : Link , Question Author : Luka , Answer Author : user1700494

Leave a Comment