Plesk can create customer databases on the local MariaDB or MySQL server, on PostgreSQL, or on separate remote database servers. Administrators decide which servers are available and which is the default. This guide covers those settings and a safe MariaDB upgrade.
Before you start
- Plesk administrator access and root SSH.
- For remote servers: the host, port and an administrative database user that may create databases and users, with network access from the Plesk server.
View database servers
Go to Tools & Settings → Database Servers. You see each server with its type, version, host and the number of databases. The local MariaDB/MySQL server is added automatically during installation.
Add a remote database server
- Click Add Database Server.
- Choose the Database server type: MySQL/MariaDB or PostgreSQL.
- Enter the hostname or IP and port (3306 or 5432).
- Enter the administrator user name and password.
- Tick Use this server as default for MySQL (or PostgreSQL) if new databases should go there.
- Click OK. Plesk tests the connection.
Remote database servers move load off the web server and let you scale, but add network latency. Keep them in the same data centre and restrict access by firewall to the Plesk server's IP.
Add PostgreSQL locally
Install it via Tools & Settings → Updates → Add/Remove Components → Plesk hosting features → PostgreSQL server. Once installed, it appears in Database Servers and customers can create PostgreSQL databases if their plan allows. See customer database management.
Default server per service plan
On a service plan's Hosting Parameters or Resources, you can choose which database server new databases in that plan use – for example premium plans on a dedicated database server.
Change the admin password
Click the server in the list and use Change Password. For the local server, Plesk updates its own stored credentials; do not change the admin password directly in MySQL, or Plesk loses access.
Upgrade MariaDB
- Back up all databases:
MYSQL_PWD=$(cat /etc/psa/.psa.shadow) mysqldump -u admin --all-databases --routines --events | gzip > /root/all-db.sql.gz - Check that customer applications support the target version.
- Follow Plesk's documented MariaDB upgrade procedure for your OS (add the MariaDB repository, upgrade packages, run
mariadb-upgrade, thenplesk sbin packagemng -sdf). - Restart services and check sites.
Never jump many major versions in one step without testing, and do it in a maintenance window.
Troubleshooting
- Cannot connect to remote server: firewall, wrong port, or the admin user is restricted to localhost.
- Databases created on the wrong server: check the default server and the service plan setting.
- MySQL fails to start after upgrade: read
/var/log/mariadb/mariadb.log; often an incompatible option inmy.cnf.
