• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question install plesk with existing psa database

dj ramc

Basic Pleskian
Hello everyone

is there a way to install plesk with already existing psa database?

thanks a lot
 
Probably not. However, you could install Plesk and then import/overwrite the psa database with a backup. In that case however you should be sure to have a psa database of exactly the same release, because else almost certainly Plesk won't work correctly as datafields might be missing, have a wrong format or important table entries might be missing.

What is your intention?
 
by removing mariadb server is plesk removed because plesk is dependency of mariadb. the purpose was after deleting the older version of mariadb to install newer version.
 
This knowledge base article describes how to upgrade MariaDB: https://support.plesk.com/hc/en-us/articles/213403429
There is no need to remove Plesk and no need to remove any data. Actually, everything stays in place and the upgrade works without problems as described.

If you took a different path and removed Plesk, then normally the web space directory /var/www/vhosts should still exists. If it still exists and if other databases still exist, make a backup of them, then reinstall Plesk, then restore /var/www/vhosts structure from backup and restore psa database. Then run the web server reconfiguration utility to re-create all webhosting configuration files from your psa database. It should give you an almost correct installation as you had before.
 
now when i try to fresh instal plesk got this
**** Product prep-install started.
Create user 'psaadm' and group 'psaadm'
Group 'psaadm' already exists
Checking for the user 'psaadm'...
User 'psaadm' already exists
Create group 'swkey-data'
Group 'swkey-data' already exists
Trying to add supplementary group 'swkey-data' for user 'psaadm'... already there
Create group 'psaserv'
Group 'psaserv' already exists
Trying to add supplementary group 'psaserv' for user 'psaadm'... already there
Create group 'psacln'
Group 'psacln' already exists
Trying to got legacy variables... done
Trying to save legacy variables... done
Checking that /usr/local/psa/bin/chrootsh registered as login shell...
/usr/local/psa/bin/chrootsh already registered as a login shell

===> Performing safe prep-install database actions


===> Upgrading database

Trying to start service mariadb... active
done
Trying to establish test connection... connected
done
Trying to find psa database... not found
ERROR 1049 (42000): Unknown database 'psa'
ERROR 1049 (42000): Unknown database 'psa'
Trying to backup MySQL database... done
MySQL databases are dumped to /home/plesk_backups/mysql.preupgrade.18.0.41-18.0.41.20220214-141708.dump.gz
ERROR 1049 (42000): Unknown database 'psa'
ERROR 1049 (42000): Unknown database 'psa'
===> Cumulative Plesk database upgrade (revertable stage) has been started.
ERROR 1049 (42000): Unknown database 'psa'
ERROR 1049 (42000): Unknown database 'psa'
Upgrade or repair for 'core' (stage 'prep') is not required
===> Preparing Plesk database upgrade (revertable stage).
Trying to set psa database version to 018000000... ERROR 1049 (42000): Unknown database 'psa'
ERROR 1049 (42000): Unknown database 'psa'

ERROR while trying to execute SQL query, the query was: replace into misc (param,val) values('version', '018000000')

Check the error reason (see log file: /var/log/plesk/install/plesk_18.0.41_installation.log), fix and try again
***** problem report *****
ERROR while trying to execute SQL query, the query was: replace into misc (param,val) values('version', '018000000')
Launching component and product checkers...
Downloading file report-update: 100% was finished.
Downloading file pool/PSA_18.0.41_8197/examiners/py_launcher.sh: 100% was finished.
Downloading file pool/PSA_18.0.41_8197/examiners/save-installation-info.php: 100% was finished.
Downloading file pool/PSA_18.0.41_8197/examiners/php_launcher.sh: 100% was finished.
Components and product check results:
Store installation info


ERROR: An error occurred during performing of installation PREP actions (see log for details). Installation was rolled back.
Warning! Not all packages were installed.
Please check if your system services are operable.
Please resolve this issue and try to install the packages again.
Visit https://support.plesk.com/ to search for a solution.
 
So what are you trying to say? Maybe you can try to understand that the whole concept of installing a fresh Plesk over a partly existing and previously destroyed installation is not a good choice?
 
is good choise to install fresh plesk. but like you see in the logs i got errors by trying install plesk
 
That is because Plesk has not been removed fully. The way to go is probably to completely rebuild the server from scratch, meaning to reinstall the operating system, then to start over with a fresh Plesk.
 
We had same problem during update from Ubuntu 16 to Ubuntu 18. For some reason Plesk was no more part of our APT sources anymore and older plesk version was deleted during migration, because of mysql dependency.
(Also, for some reason, including "psa" database, which you must restore from a database backup in any case)

You should check, if deinstallation deletes configuration files of Plesk. Because normally deletion of package don't do and this is important to recover without a full reinstallation.
If not, you can simple install plesk like a default installation and everything should come back.
But don't execute the default installation routine. We didn't do, because Plesk cannot "install" on an existing database -> We wouldn't check this result. ;)

We then used the plesk repair tools, to check all configurations. (Plesk Repair Utility)
 
hello Peter

when i follow your link for upgrade mariadb it fails


[root@ns2 ~]# ./mariadb-10.5-upgrade.sh
Dumping all databases
stopping MariaDB service
creating backup of mysql directory
removing mysql-server package in case it exists
error: package MariaDB-server-10.2.43-1.el7.centos.x86_64
MariaDB-server-10.2.43-1.el7.centos.x86_64 is not installed
Upgrading MariaDB
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.rezopole.net
OVH-metrics/7/x86_64/signature | 833 B 00:00
OVH-metrics/7/x86_64/signature | 2.9 kB 00:00 !!!
OVH-rtm/7/x86_64/signature | 833 B 00:00
OVH-rtm/7/x86_64/signature | 2.9 kB 00:00 !!!
PLESK_17_PHP56 | 2.9 kB 00:00
PLESK_17_PHP72 | 2.9 kB 00:00
PLESK_17_PHP73 | 2.9 kB 00:00
PLESK_17_PHP74 | 2.9 kB 00:00
PLESK_18_0_39-extras | 2.9 kB 00:00
akopytov_sysbench/x86_64/signature | 833 B 00:00
akopytov_sysbench/x86_64/signature | 1.0 kB 00:00 !!!
akopytov_sysbench-source/signature | 833 B 00:00
akopytov_sysbench-source/signature | 1.0 kB 00:00 !!!
base | 3.6 kB 00:00
extras | 2.9 kB 00:00
gf | 2.9 kB 00:00
mariadb | 3.4 kB 00:00
Not using downloaded mariadb/repomd.xml because it is older than what we have:
Current : Sat Feb 12 06:00:39 2022
Downloaded: Sat Feb 12 04:49:40 2022
mysql-connectors-community | 2.6 kB 00:00
mysql-tools-community | 2.6 kB 00:00
mysql57-community | 2.6 kB 00:00
nodesource | 2.5 kB 00:00
ovhkernel | 2.9 kB 00:00
plesk-ext-nodejs | 2.9 kB 00:00
plesk-ext-panel-migrator | 2.9 kB 00:00
updates | 2.9 kB 00:00
Package MariaDB-client-10.4.24-1.el7.centos.x86_64 already installed and latest version
Package MariaDB-compat-10.4.24-1.el7.centos.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package MariaDB-server.x86_64 0:10.2.43-1.el7.centos will be updated
---> Package MariaDB-server.x86_64 0:10.4.24-1.el7.centos will be an update
---> Package MariaDB-shared.x86_64 0:10.4.24-1.el7.centos will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
MariaDB-shared x86_64 10.4.24-1.el7.centos mariadb 112 k
Updating:
MariaDB-server x86_64 10.4.24-1.el7.centos mariadb 26 M

Transaction Summary
================================================================================
Install 1 Package
Upgrade 1 Package

Total download size: 26 M
Downloading packages:
No Presto metadata available for mariadb
MariaDB-server-10.4.24-1.el7.c FAILED
http://yum.mariadb.org/10.5/centos7-amd64/rpms/MariaDB-server-10.4.24-1.el7.cent os.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below wiki article


If above article doesn't help to resolve this issue please use https://bugs.cent os.org/.

MariaDB-shared-10.4.24-1.el7.c FAILED
http://yum.mariadb.org/10.5/centos7-amd64/rpms/MariaDB-shared-10.4.24-1.el7.cent os.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.


Error downloading packages:
MariaDB-shared-10.4.24-1.el7.centos.x86_64: [Errno 256] No more mirrors to try .
MariaDB-server-10.4.24-1.el7.centos.x86_64: [Errno 256] No more mirrors to try .

This installation of MariaDB is already upgraded to 10.2.27-MariaDB.
There is no need to run mysql_upgrade again for 10.2.43-MariaDB.
You can use --force if you still want to run mysql_upgrade
Informing Plesk of the changes (plesk sbin packagemng -sdf)
Created symlink from /etc/systemd/system/mysql.service to /usr/lib/systemd/syste m/mariadb.service.
Created symlink from /etc/systemd/system/mysqld.service to /usr/lib/systemd/syst em/mariadb.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@ns2 ~]#
 
The version is wrong. You cannot use a 10.5 repository to update to a 10.4 version. I see you are using a script for the upgrade, but is the script content correct and have you set the correct MariaDB repository in YUM?

Change repository file /etc/yum.repos.d/mariadb.repo to new MariaDB version:
Code:
#http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.5/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
Also check your script that it refers to the correct new version in all lines.
 
The version is wrong. You cannot use a 10.5 repository to update to a 10.4 version. I see you are using a script for the upgrade, but is the script content correct and have you set the correct MariaDB repository in YUM?

Change repository file /etc/yum.repos.d/mariadb.repo to new MariaDB version:
Code:
#http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.5/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
Also check your script that it refers to the correct new version in all lines.


install script
#!/bin/bash

echo "Dumping all databases"
MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -u admin --verbose --all-databases --routines --triggers > /tmp/all-databases.sql 2&> /dev/null

#avoid inconsistency with repo if one exists
if [ -f "/etc/yum.repos.d/MariaDB.repo" ] ; then
mv /etc/yum.repos.d/MariaDB.repo /etc/yum.repos.d/mariadb.repo
fi

#Stopping MariaDB
echo "stopping MariaDB service"
systemctl stop mariadb


echo "creating backup of mysql directory"
cp -v -a /var/lib/mysql/ /var/lib/mysql_backup 2&> /dev/null

echo "removing mysql-server package in case it exists"
rpm -e --nodeps "`rpm -q --whatprovides mysql-server`"

echo "Upgrading MariaDB"

echo "#Download MariaDB Server - MariaDB.org
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.5/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1" > /etc/yum.repos.d/mariadb.repo

yum install MariaDB-client MariaDB-server MariaDB-compat MariaDB-shared -y

systemctl restart mariadb

MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql_upgrade -uadmin

systemctl restart mariadb

echo "Informing Plesk of the changes (plesk sbin packagemng -sdf)"
plesk sbin packagemng -sdf

systemctl start mariadb # to start MariaDB if not started
systemctl enable mariadb # to make sure that MariaDB will start after the server reboot automatically
 
That cannot be right, because your output clearly states that the script is trying to update with a 10.4 repository. Your system is either not using the given yum file or that is overwritten again or it is using a wrong mirror or the mirror is not updated to the latest version or, or, or, ...

After all the mess you have described above I think it is not worth to spend any more time with upgrade or fixing attempts. It's just not worth the effort. Given the errors as described above I think it is very unlikely that this is leading anywhere useful. At least it will need on-server investigation, but again, it makes no sense to invest more time.
 
Simply upload your Plesk backup files to any FTP storage space, then link the Plesk backup configuration to that storage space.
 
Sure, you can either restore all or restore specific objects, e.g. only a website, a file, a database, a mailbox etc.
 
Back
Top