My root@localhost user has the password, but a sudo-user can access from command line without password, is it possibile to disable this sudo command line access?

  • Since you're seemingly concerned about security, this one(vs others) has more arguments on why/why not to use the configurations superuser.com/questions/735172/…
    – WU-TANG
    Oct 20, 2020 at 15:29
  • I simply don't want to share my database structure to all sudo users.
    – Tobia
    Oct 20, 2020 at 16:15

1 Answer 1


To avoid entering with sudo and that only root can enter, only recommended for your database installed locally and not in production, you could use mysql_secure_installation with a password for root.

sudo mysql_secure_installation

With this command you go through a wizard that will ask you different questions. You must tell it to keep the root user, with a password. and so you could access through without sudo.

mysql -u root -p

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.