Private customers Business customers

Create a MySQL databaseManage it with phpMyAdmin

Every CMS and every shop needs a database. This guide shows how to create a MariaDB database including a user in Plesk Obsidian, manage it with phpMyAdmin and import or export data.

MariaDB5 to 40 databasesphpMyAdmin

Published on

What you need a database for

Static sites made of pure HTML files get by without a database. As soon as content is managed dynamically - with WordPress, Joomla, a shop or a forum - texts, settings and user accounts live in a database, while only the program code and images are stored on the web hosting.

The database system used on the web hosting is MariaDB - the widely used, MySQL-compatible successor. Applications that require MySQL run on it unchanged; credentials and tools are the same too. We currently use the LTS series MariaDB 10.11.

The interplay of files and database has an important consequence for backups: a copy of the files alone is not a complete backup. Without the matching database state, all content is missing. More on this in the guide Create and restore backups.

Rent web hosting from €1.99 / month

Prepaid without a contract, Plesk included.

View plans & prices

Create a database in Plesk

  1. In Plesk, open the Databases section and click Add Database.
  2. Give it a name. Descriptive names help later - such as wp_mainsite instead of db1.
  3. Select the associated domain so that the assignment stays traceable.
  4. In the same dialog, create a database user and set a long, random password.
  5. Save and note the four values: database name, user name, password and host.

As the host, localhost usually goes into your application's configuration, because web server and database run on the same system.

One user per database

It is tempting to use a single database user for all projects. Do not do it. If one application is compromised, the attacker would otherwise have access to all databases on the web hosting - including the user accounts and order data of all other projects.

So create a separate user with its own password for each database. The extra effort is a few seconds per installation.

Enter the credentials in the application

After creating it, you enter the credentials in your application's configuration:

  • WordPress: in wp-config.php, the constants DB_NAME, DB_USER, DB_PASSWORD and DB_HOST.
  • Joomla: the corresponding fields in configuration.php.
  • Your own applications: in the respective configuration file or via environment variables.

If you install WordPress via the WordPress Toolkit, this step disappears - database, user and configuration are generated automatically. See Install WordPress.

Manage with phpMyAdmin

From the database overview in Plesk, one click takes you to phpMyAdmin - a graphical interface with which you can view tables, change values and run SQL queries. Typical tasks:

  • Export: via the Export tab, you create a complete SQL dump as a file - the default settings are suitable for backups and moves.
  • Import: via Import, you load a dump into an empty database.
  • Search and replace: after a domain change or an SSL switch, old addresses can be replaced via SQL query.
  • Clean up: old revisions, orphaned metadata and spam comments noticeably bloat WordPress databases over the years.

Before every direct intervention in the database, without exception: export first, then change. A faulty UPDATE cannot be undone.

Import large dumps

Importing via phpMyAdmin is tied to PHP's maximum upload size. Depending on the plan, it is 10 to 100 MB - larger dumps abort.

Two ways out: raise the values for upload size and maximum execution time in the domain's PHP settings (see Change the PHP version and settings), or split the dump into several files when exporting. With very large databases, support can help you.

Typical error messages

  • "Error establishing a database connection": a value in the configuration is wrong. Check database name, user and password - and that localhost is entered as the host.
  • "Access denied for user": the user exists but has no rights to this database. Check the assignment in Plesk.
  • Import aborts without a message: file too large or time limit reached - see the section above.
  • Garbled characters after the import: a different character encoding was used for export than for import. Use utf8mb4 in both steps.

If you move a site from another provider, the database is part of the process described in Migrate a website.

Frequently asked questions

MariaDB runs on the web hosting, currently in the LTS series 10.11. MariaDB is the MySQL-compatible successor: applications such as WordPress, Joomla or common shop systems that require MySQL run on it unchanged. Tools and credentials are identical too; you manage the databases as usual via phpMyAdmin.

Plan S includes 5 databases, plan M 10, plan L 20 and plan XL 40. Every CMS or shop installation takes up exactly one database - that determines how many projects fit on one web hosting plan.

As a rule, localhost, because web server and database run on the same system. It only differs if your application explicitly requires something else - Plesk shows the binding values in the database overview.

Yes. Export the database at your previous provider via phpMyAdmin as an SQL file, create an empty database with us and import the dump there. Make sure to use the same character encoding in both steps, otherwise special characters get garbled.

Either via the backup manager in Plesk, which backs up files and databases together, or specifically via export in phpMyAdmin. It is important that a backup always includes files and database - a copy of the files alone contains no content.

Recommended, yes. A shared user for all databases means that a compromised application would have access to all projects on the web hosting. A separate user per database takes a few seconds and limits the damage.

Databases depending on the plan

Plan S includes 5 databases, plan XL 40. Every CMS installation takes up exactly one - that determines how many projects fit on one web hosting plan.

View web hosting plans & prices