Skip to content
  • Solutions
    By Role
    • For Developers
    • For Content Managers
    • For Agencies
    • For IT Admins
    • For Web Hosters
    • For Developers
    • For Content Managers
    • For Agencies
    • For IT Admins
    • For Web Hosters
    By Infrastructure
    • Overview
    • AWS
    • Microsoft Azure
    • Alibaba Cloud
    • Google Cloud Platform
    • Vultr
    • Overview
    • AWS
    • Microsoft Azure
    • Alibaba Cloud
    • Google Cloud Platform
    • Vultr
    • Digital Ocean
    • Linode
    • Upcloud
    • Oracle
    • OVH
    • Digital Ocean
    • Linode
    • Upcloud
    • Oracle
    • OVH
  • Product
    • Plesk Features
    • Plesk Editions
    • What’s new
    • Pricing
    • Roadmap
    • Lifecycle Policy
    • Extensions Catalogue
  • Pricing
  • Extensions
    Featured Extensions
    • SocialBee
    • WP Toolkit
    • Sitejet Builder for Plesk
    • SEO Toolkit
    • Joomla! Toolkit
    • Premium Email
    • Email Security
    • SocialBee
    • WP Toolkit
    • Sitejet Builder for Plesk
    • SEO Toolkit
    • Joomla! Toolkit
    • Premium Email
    • Email Security
    Bundles and packs:
    • Business and Collaboration Edition
    • WP pack
    • Hosting pack
    • Power pack
    • Language pack
    • Business and Collaboration Edition
    • WP pack
    • Hosting pack
    • Power pack
    • Language pack

    See all Extensions

  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
  • Pricing
  • Solutions
    • By Role
      • For Developers
      • For Content Managers
      • For Agencies
      • For IT Admins
      • For Web Hosters
    • By Infrastructure
      • Overview
      • Plesk on Amazon Web Services (AWS & Lightsail)
      • Microsoft Azure
      • Alibaba Cloud
      • Google Cloud Platform
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
      • Oracle
      • OVH
  • Products
  • Pricing
  • Extensions
    • Featured Extensions
      • SocialBee
      • WP Toolkit
      • Sitejet Builder for Plesk
      • SEO Toolkit
      • Joomla! Toolkit
      • Premium Email
      • Email Security
    • Bundles and packs:
      • Business and Collaboration Edition
      • WP pack
      • Hosting pack
      • Power pack
      • Language pack
      • See all Extensions
  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate Program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
  • Pricing
  • Solutions
    • By Role
      • For Developers
      • For Content Managers
      • For Agencies
      • For IT Admins
      • For Web Hosters
    • By Infrastructure
      • Overview
      • Plesk on Amazon Web Services (AWS & Lightsail)
      • Microsoft Azure
      • Alibaba Cloud
      • Google Cloud Platform
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
      • Oracle
      • OVH
  • Products
  • Pricing
  • Extensions
    • Featured Extensions
      • SocialBee
      • WP Toolkit
      • Sitejet Builder for Plesk
      • SEO Toolkit
      • Joomla! Toolkit
      • Premium Email
      • Email Security
    • Bundles and packs:
      • Business and Collaboration Edition
      • WP pack
      • Hosting pack
      • Power pack
      • Language pack
      • See all Extensions
  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate Program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
Plesk 360 login
Free Trial

Knowledge Base

How to chroot MySQL/MariaDB client for users in Plesk?

 
centoschrootcloudlinuxdatabasedatabases

Question

How to chroot MySQL/MariaDB client for users in Plesk?

Answer

Warning: It is not recommended to give access to MySQL/MariaDB in the chrooted environment as it is designed to isolate a system user from any system services. Proceed with the following steps at your own risk.

  1. Connect to the server via SSH;

  2. Download and unzip the update-chroot script:

    # wget https://raw.githubusercontent.com/plesk/kb-scripts/master/update-chroot/update-chroot.sh && chmod +x update-chroot.sh

  3. Add the mysql command and all the required files to the chrooted environment and apply it to all domain:

    # ./update-chroot.sh --add mysql
    # ./update-chroot.sh --apply all

    • Afterwards, it should be possible to use the mysql command as follows:

      # mysql -u db_user -p -h127.0.0.1 db_name

    • In order to access the database without the -h127.0.0.1 option, create the /var/www/vhosts/example.com/.my.cnf file with the following content:

      # cat /var/www/vhosts/example.com/.my.cnf
      [mysql]
      host=127.0.0.1

  4. Mount a MySQL/MariaDB socket under the domain's chrooted shell:

For CentOS/RHEL/CloudLinux:

  • Create the following directory for the corresponding domain:

    # mkdir -p /var/www/vhosts/example.com/var/lib/mysql

  • Bind the MySQL socket to the chrooted directory:

    # mount -o bind,ro /var/lib/mysql /var/www/vhosts/example.com/var/lib/mysql

For Debian/Ubuntu:

  • Create the following directory for the corresponding domain:

    # mkdir -p /var/www/vhosts/example.com/var/run/mysqld

  • Bind the MySQL socket to the chrooted directory:

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

Additional Information

How to add programs to a chrooted shell environment template in Plesk 

Tweet
Share
Share
Email
0 Shares
Read the full article
Related Posts

WP Toolkit 6.2 Release Now Available

Read More »

Plesk with Centralized Database and Network File System

Read More »

Recommended OSs for Plesk

Read More »
Knowledge Base

MariaDB logrotate on Plesk server reports error: logrotate_script: 3: [: /var/run/mysqld/mysqld.pid: unexpected operator

Read More »

How to enable remote access to MySQL/MariaDB server in Plesk?

Read More »

How to reinstall phpMyAdmin in Plesk for Linux

Read More »

Which MySQL versions are supported by Plesk?

Read More »

Hosting Wiki

  • Server Redundancy
  • Bare Metal Server
  • MySQL
  • Oracle VM Server
  • Server Virtualization Software
  • Windows Server
  • Linux
  • SQL
  • Plesk
  • SQL database
  • NoSQL Database
  • Web Server
  • DNS Server
  • SSH
  • HTTP
X-twitter Linkedin Youtube Reddit Github
  • Product
  • Login
  • Pricing
  • Editions
  • For Partners
  • Partner Program
  • Contributor Program
  • Affiliate Program
  • Plesk University
  • Company
  • Blog
  • Careers
  • Events
  • About Plesk
  • Our Brand
  • Resources
  • User and Admin guides
  • Help Center
  • Migrate to Plesk
  • Contact Us
  • Hosting Wiki
  • Forum
  • Legal
  • Legal
  • Privacy Policy
  • Imprint

© 2025 WebPros International GmbH

Part of the WebPros®  Family