Articles in this section

How to reinstall phpMyAdmin in Plesk for Linux

kb: how-to Plesk for Linux

Applicable to:

  • Plesk for Linux

Question

How to reinstall phpMyAdmin in Plesk?

Answer

  1. Connect to a Plesk server via SSH.

  2. Get the phpMyAdmin database name and MySQL username:

    Note: If the file /usr/local/psa/phpMyAdmin/config.plesk.php does not exist, move to step 7.

    • Database name

      # grep pmadb /usr/local/psa/phpMyAdmin/config.plesk.php | grep -v NOTE

      $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';

    • Username

      # grep controluser /usr/local/psa/phpMyAdmin/config.plesk.php | grep -v NOTE

      $cfg['Servers'][$i]['controluser'] = 'phpmyadmin';

  3. Check if the phpmyadmin database exists on the server:

    # plesk db "show databases like '%phpmy%'"
    +--------------------+
    | Database (%phpmy%) |
    +--------------------+
    | phpmyadmin         |
    +--------------------+

    Note: Databases with the names like phpmyadmin_XXXXXXXXXXXX are likely to be the customers' databases. Do not remove them.

    If it is, create a backup this database:

    # plesk db dump phpmyadmin > /root/phpmyadmin.sql

  4. Remove this database from MySQL:

    # plesk db "drop database phpmyadmin"

  5. Check if the phpmyadmin user exists in the mysql.user table:

    # plesk db "select User from mysql.user where User like '%phpmy%'"
    +------------------+
    | User       |
    +------------------+
    | phpmyadmin |
    +------------------+

    If it is, create a backup of the MySQL database:

    # plesk db dump mysql > /root/mysql`date +%F_%H.%M`.sql

    And remove this user:

    # plesk db "DROP USER 'phpmyadmin'@'localhost'"

  6. Restart MariaDB/MySQL:

    # systemctl restart mariadb

  7. Remove the phpMyAdmin package:

    • on CentOS/RHEL-based distributions

      # rpm -e --nodeps psa-phpmyadmin

    • on Debian/Ubuntu-based distributions

      # dpkg -r --force-depends psa-phpmyadmin

  8. Reinstall phpMyAdmin:

    # plesk installer update

    Note: If the "phpMyAdmin was configured without configuration storage in database" warning is shown during phpMyAdmin reinstallation, it means that either the phpmyadmin database or user have not been set up because they already exist in the system. Make sure the database and the user are deleted and then repeat the reinstallation.

 

If the steps above did not help

If after the above actions phpMyAdmin had no entries in the database or the file /usr/local/psa/phpMyAdmin/config.plesk.php is missing:

  1. Create the main configuration file from a sample file:

    # cp /usr/local/psa/phpMyAdmin/config.plesk.php.tpl /usr/local/psa/phpMyAdmin/config.plesk.php

  2. Edit it as follows:

    CONFIG_TEXT: /* User used to manipulate with storage /
    $cfg['Servers'][$i]['controlhost'] = 'localhost';
    $cfg['Servers'][$i]['controlport'] = '';
    $cfg['Servers'][$i]['controluser'] = 'phpmyadmin';
    $cfg['Servers'][$i]['controlpass'] = '<password>';

    /
    Storage database and tables */
    $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
    $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
    $cfg['Servers'][$i]['relation'] = 'pma__relation';
    $cfg['Servers'][$i]['table_info'] = 'pma__table_info';

  3. Connect to MySQL:

    # plesk db

  4. Switch to the MySQL database:

    MYSQL_LIN: use mysql;

  5. Create a corresponding user:

    MYSQL_LIN: MariaDB [mysql]> CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY '<password>';

    MYSQL_LIN: MariaDB [mysql]> GRANT ALL ON *.* TO 'phpmyadmin'@'localhost' with grant option;

  6. Create a corresponding database:

    MYSQL_LIN: MariaDB [mysql]> create database phpmyadmin;

 

Was this article helpful?

Comments

4 comments
Date Votes
  • Hello

    Unfortunately this tutorial did not help me, because the installer started after the command

    plesk installer update

    has generated countless error messages.

    Downloading file pmm.inf3: 0%
    Downloading file pmm.inf3: 100% was finished.
    Checking for installed packages...
    sh: 0: getcwd() failed: No such file or directory
    ....
    Downloading file pool/WPB_18.0.53_67/sitebuilder-18.0.53-deball-all.inf3: 100% was finished.
    sh: 0: getcwd() failed: No such file or directory
    sh: 0: getcwd() failed: No such file or directory
    sh: 0: getcwd() failed: No such file or directory
    sh: 0: getcwd() failed: No such file or directory
    Registering i386 architecture support
    sh: 0: getcwd() failed: No such file or directory
    Synchronizing the Debian APT package index files...
    sh: 0: getcwd() failed: No such file or directory
    .....
    Checking whether the package dependencies are resolved.
    Installing packages
    sh: 0: getcwd() failed: No such file or directory
    sh: 0: getcwd() failed: No such file or directory
    sh: 0: getcwd() failed: No such file or directory
    shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
    shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
    job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
    job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
    ......
    Reading package lists...
    Building dependency tree...
    Reading state information...
    The following NEW packages will be installed:
      psa-phpmyadmin
    sh: 0: getcwd() failed: No such file or directory
    N: Ignoring file 'plesk.list.ai_back' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
    0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
    Need to get 0 B/7651 kB of archives.
    After this operation, 49.9 MB of additional disk space will be used.
    Selecting previously unselected package psa-phpmyadmin.
    (Reading database ... 75254 files and directories currently installed.)
    Preparing to unpack .../psa-phpmyadmin_5.2.1-v.ubuntu.22.04+p18.0.53.2+t230619.1201_all.deb ...
    Unpacking psa-phpmyadmin (5.2.1-v.ubuntu.22.04+p18.0.53.2+t230619.1201) ...
    Setting up psa-phpmyadmin (5.2.1-v.ubuntu.22.04+p18.0.53.2+t230619.1201) ...
    sh: 0: getcwd() failed: No such file or directory
    sh: 0: getcwd() failed: No such file or directory
    shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
    shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
    job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
    ...
    0
  • job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
    sh: 0: getcwd() failed: No such file or directory
    sh: 0: getcwd() failed: No such file or directory
    [2023-06-21 12:51:26.577] 63365:6492f24e8c65e ERR [panel] No such file or directory
    Launching component and product checkers...
    Downloading file report-update: 0%
    Downloading file report-update: 100% was finished.
    Downloading file pool/PSA_18.0.53_12045/examiners/py_launcher.sh: 0%
    Downloading file pool/PSA_18.0.53_12045/examiners/py_launcher.sh: 100% was finished.

    The changes were applied successfully.
    0
  • plesk db "show databases"
    +--------------------+
    | Database           |
    +--------------------+
    | apsc               |
    | information_schema |
    | magento19_ble_prod |
    | mysql              |
    | performance_schema |
    | psa                |
    | roundcubemail      |
    | sys                |
    +--------------------+

    How to repair PHPMyAdmin?
    What is the reason for these countless (identical) error messages?

    0
  • After the standard solution steps described above, a restart of sw-cp-server and sw-engine are required, too.

    0

Please sign in to leave a comment.