Creating a MySQL database for a site, and importing or exporting data with phpMyAdmin. The servers run MariaDB 11.4.
Create a database
- In cPanel open Manage My Databases.
- Under Create New Database type a name and click Create Database. cPanel adds your username as a prefix, so the full name looks like
username_shop. - Under MySQL Users add a user with a strong password. This user is separate from your cPanel login.
- Under Add User To Database pick the user and the database, click Add, tick ALL PRIVILEGES and save.
In your site's config file use host localhost, plus the full database name and full username including the prefix. Database Wizard does the same three steps in one guided page.
phpMyAdmin
- Export: open phpMyAdmin, click your database, then Export. The Quick method with SQL format is enough for a backup.
- Import: create an empty database first, open it in phpMyAdmin, click Import, choose the
.sqlor.sql.gzfile and click Import.
If it doesn't work
- "Access denied" in your site: the user is not attached to the database, or the name is missing its prefix.
- Import stops or says the file is too large: the web import is limited by the PHP upload size (50 MB by default). Compress the file as
.sql.gz, or split it into smaller parts. - Import times out: split the dump, or raise the limits in Changing PHP settings such as memory limit and upload size.
- Connecting from your own computer is off by default. Remote Database Access lets you allow a single IP address. Only add addresses you trust.