A static site only needs files. As soon as you install a CMS, a shop or a forum, you need a database. Your plan allows a certain number: the Databases card in your client area tells you how many.
How do I create a MySQL database on my hosting?
Open Plesk from the client area, go to Databases, then Add Database: the database and its user are created in the same window.
- From the client area, click Automatic connection to open Plesk.
- Open Databases, then Add Database.
- Give the database a name. Keep it plain: lowercase letters, digits and
_, no accents or spaces. - In the same window, create the matching user: a name, then a long unique password.
- Confirm.
Create one user per database. A single account shared across all your sites means a flaw in the least important of them opens the data of all the others.
Which details does my application ask for to connect to its database?
An application will always ask for the same four values:
- Host:
localhost— your site and its database run on the same server; - Database name;
- User;
- Password.
These end up in your application's configuration file: wp-config.php for WordPress, .env for a Laravel or Symfony project, configuration.php for Joomla.
If the application refuses to connect, the cause is almost always a typo in one of those four fields, or a password containing a badly escaped character.
How do I import an existing database?
Export the database from your previous host as a .sql file, then run Import Dump in Plesk on the target database.
To take over a site already online elsewhere:
- Export the database from your previous host, in
.sqlformat. - In Plesk, open Databases, then Import Dump on the target database. If the file is large, compress it to
.zipor.gzbefore uploading. - For small files, phpMyAdmin — reachable from the same page — works too: the Import tab.
An import that stops without a message is nearly always a file too large for the upload limit. Compress it, or split it.
How do I administer my database day to day?
phpMyAdmin is your main tool. From Plesk, click the link on the database concerned. There you can browse tables, run SQL queries and fix a single value.
Three precautions are worth taking:
- Export before any
UPDATEorDELETE. There is no undo button. - Check your
WHEREclause before running. A forgottenWHEREapplies the change to the whole table. - Do not use phpMyAdmin as a data entry tool: your application knows its own consistency rules, phpMyAdmin does not.
How do I back up my database?
Run an SQL export before every significant update of your site, and keep a periodic copy off the server.
This is the part everyone postpones until the day it is missing.
- A manual SQL export before every significant update of your site.
- A periodic export kept off the server: on your computer or third-party storage. A backup living in the same disk space disappears with it.
- A test restore now and then, into a secondary database, to confirm the file is usable.
The Plesk backup manager can also schedule backups of your space: it complements your exports rather than replacing them.
Why does my database take up so much space?
Your database counts towards the Disk quota shown in your client area. Two things inflate a database without the site growing:
- revisions and logs accumulated by a CMS;
- session or cache tables that are never purged.
An annual clean-up is usually enough to get back to a healthy baseline.