How to chroot MySQL for users

Created:

2017-03-27 05:30:08 UTC

Modified:

2017-08-08 13:14:20 UTC

1

Was this article helpful?


Have more questions?

Submit a request

How to chroot MySQL for users

Applicable to:

  • Plesk 12.5 for Linux

Question

How to make MySQL available for chrooted Plesk users?

Answer

First of all, it is not recommended to give the access to MySQL in chrooted environment as it is designed to isolate a user from any system services.

  1. Follow the instructions from article #213909545
  2. Create the following folder for required domain:
    # mkdir -p /var/www/vhosts/example.com/var/run/mysqld
  3. Bind MySQL socket to the folder:
    # mount --bind /var/run/mysqld /var/www/vhosts/example.com/var/run/mysqld
Have more questions? Submit a request

2 Comments

  • 0
    Avatar
    Rico Rothenburger

    That's not a good idea. Logged-in users can delete the file, which terminates the entire MySQL server.

    better: mount -o bind,ro /var/run/mysqld /var/www/vhosts/example.com/var/run/mysqld

    In general, however, the mount causes Plesk to delete the file and the MySQL server is no longer working. For example, if you delete the client, then all files will be deleted and also the mysqld.sock file.

    Is this workaround only for Plesk 12.5?

    Edited by Rico Rothenburger
  • 0
    Avatar
    Bulat Tsydenov

    @Rico This workaround is applicable for all currently supported Plesk versions for Linux

Please sign in to leave a comment.