MySQL Access in Jailkit [Debian 9 + ISPconfig3]

Discussion in 'Installation/Configuration' started by Zendo_vysn, May 25, 2019.

  1. Zendo_vysn

    Zendo_vysn New Member

    EDIT: Sorry, I think this should be moved to Server Operation.

    I having some issues enabling mysql support for jailkit environment. I need to allow my clients to run some PHP commands to make changes to their websites.

    MySQL:
    mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 24111

    This is the error I get when running from the jailed user:

    $ mysqladmin ping
    mysqladmin: connect to server at 'localhost' failed
    error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111 "Connection refused")'
    Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!


    I have tested it in several ways:
    $ nano /etc/jailkit/jk_init.ini
    [mysql_client]
    comment = mysql client
    executables = /usr/bin/mysql, /usr/bin/mysqladmin, /usr/bin/mysqlcheck, /usr/bin/mysqldump, /usr/bin/mysqlhotcopy, /usr/bin/mysql$
    paths = /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18.0.0, /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18, /usr/lib/x86_64-linux$
    regularfiles = /etc/mysql/my.cnf
    $ jk_init -c /etc/jailkit/jk_init.ini -f -k -j /var/www/clients/client1/web1 mysql_client

    and

    $ jk_cp -f -v -j /var/www/clients/client1/web1/ /var/run/mysqld

    /var/run/mysql/mysqld.sock Had to copy this manually to the jailed user as otherwise the environment just doesn't find it. Permission are set to 777 and mysql:mysql
     
    Last edited: May 25, 2019
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Use this command instead:

    mysqladmin -h localhost ping

    Copying the mysql socket into does not work well as you will lose connection on each mysql restart, that's why it's better connect by tcp which can be achieved by adding '-h localhost' to mysql and mysqladmin commands when working within a jail.
     
    Zendo_vysn likes this.
  3. Zendo_vysn

    Zendo_vysn New Member

    Thanks, using 127.0.0.1 instead of localhost actually fixed the problem. All the setup was good apparently.
     
    Last edited: May 26, 2019
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Ah yes, sorry. Meant 127.0.0.1 indeed as this forces mysql to use the network stack instead of the socket.
     

Share This Page