Applicable to:
- Plesk for Linux
Question
How to reinstall phpMyAdmin in Plesk?
Answer
-
Connect to a Plesk server via SSH.
-
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';
-
-
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
-
Remove this database from MySQL:
# plesk db "drop database phpmyadmin"
-
Check if the
phpmyadmin
user exists in themysql.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'"
-
Restart MariaDB/MySQL:
# systemctl restart mariadb
-
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
-
-
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 after the above actions phpMyAdmin had no entries in the database or the file /usr/local/psa/phpMyAdmin/config.plesk.php
is missing:
-
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
-
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'; -
Connect to MySQL:
# plesk db
-
Switch to the MySQL database:
MYSQL_LIN: use mysql;
-
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;
-
Create a corresponding database:
MYSQL_LIN: MariaDB [mysql]> create database phpmyadmin;
Comments
4 comments
Hello
Unfortunately this tutorial did not help me, because the installer started after the command
has generated countless error messages.
How to repair PHPMyAdmin?
What is the reason for these countless (identical) error messages?
After the standard solution steps described above, a restart of sw-cp-server and sw-engine are required, too.
Please sign in to leave a comment.