I installed some time ago Mysql 5.6 on Ubuntu server 12.04 and now I'd like to enhance security by putting mysql into a CHROOT environment on that same Ubuntu server.

Is this possible without re-installing the whole mysql? mysql files are under var/lib and system files are under OPT/mysql/server-5.6

Anyone did this before? Thanks

1 Answer 1


I didn't tested it but mysql has build in support for chroot by adding "chroot=/path/to/chroot" into my.cnf

Normally mysql should start and load all libraries and the log files it needs and then make a chroot to the path set in the parameter. That means the database must be in the chroot and the path in the config file have to be relative to the chroot.

So if your "datadir" path is set to /var/lib/mysql/data and your chroot is /var/lib/mysql you have to change the "datadir" path to /data

According to the documentation LOAD DATA INFILE and SELECT ... INTO OUTFILE having some limits.


  • thank you for this. What do you mean by "havong some limits"? Do you mean this may cause errors?
    – Mel
    Commented Feb 23, 2014 at 6:22
  • I think the limitation is that the output path is in the chroot. Commented Feb 23, 2014 at 11:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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