DirectAdmin tutorials
DirectAdmin MySQL Databases and phpMyAdmin: Create, Connect, Import and Export
By ProWebHosting team. Published 13 September 2026. 9 min read.
To create a MySQL database in DirectAdmin, open Account Manager, click MySQL Management, then Create new Database. Enter a short database name and a database username, set a strong password and save. DirectAdmin prefixes both names with your account username, so a database called wp becomes username_wp. Open phpMyAdmin from the same page to import, export or edit tables, and put the full prefixed names into wp-config.php.
Almost every website you will run on shared hosting keeps its content in a MySQL database: WordPress posts, WooCommerce orders, Laravel users, Joomla articles. The files live in public_html, but the words and settings live in the database. DirectAdmin gives you a MySQL Management page to create databases and users, and phpMyAdmin to look inside them. This guide covers both, plus the two places people get stuck: the username prefix and wp-config.php.
How many databases you get on each plan
One database usually serves one application. A single WordPress site needs one, a second WordPress site on an addon domain needs another, and a separate Laravel app needs a third. Our plans set the database limit to match the number of sites each tier is designed for.
| Plan | Databases | Domains | Good for |
|---|---|---|---|
| Promotional | 5 | 1 domain | One WordPress site plus a staging copy or a small second app |
| Advanced | 15 | 1 domain + 5 addon domains | A freelancer or small agency with a handful of client sites |
| Professional | 25 | 1 domain + 10 addon domains | An agency or a business running several apps and stores |
| Business | Unlimited | Unlimited addon domains | Anyone who does not want to count |
Storage still applies. A database counts against the disk space of your plan, and a WooCommerce store with years of orders can grow to several hundred megabytes. See the full limits on our hosting plans page.
Step by step: create a database and a database user
Create a MySQL database in DirectAdmin
- 1
Open MySQL Management
Log in to DirectAdmin. Under Account Manager, click MySQL Management. The page lists every database on your account with its size, table count and the users attached to it.
- 2
Click Create new Database
The create form opens on the same page. You will see a field for the database name and a section for the database user.
- 3
Enter a short database name
Type something meaningful and short, such as wp, shop or crm. DirectAdmin adds your account username and an underscore in front of it automatically, so the real name will be something like username_wp. Do not type the prefix yourself.
- 4
Create the database user
Type a database username, which is also prefixed. You can reuse an existing database user from the dropdown, but a separate user per database is safer. Use a long random password: DirectAdmin can generate one for you.
- 5
Save and copy the details
Click the create button. The page shows the full database name, the full username and the password. Copy all three somewhere safe now. The host name for connections from your own site is always localhost.
The username prefix pattern, explained once
On shared hosting many accounts share one MySQL server, so database names must be unique across the whole machine. DirectAdmin solves this by prefixing every database name and every database username with your account username followed by an underscore. If your DirectAdmin login is asadtraders and you create a database called wp with a user called wpuser, the real names are asadtraders_wp and asadtraders_wpuser.
Every application that connects to the database needs the full prefixed names. The single most common database error we see, "Access denied for user" or "Unknown database", comes from typing only the short part. When in doubt, copy the names exactly as MySQL Management shows them in the list.
Opening phpMyAdmin from DirectAdmin
phpMyAdmin is the web tool for looking inside a database: browsing tables, running SQL, editing a row, importing and exporting. DirectAdmin links to it from the MySQL Management page and from the main menu, and the link signs you in automatically with your DirectAdmin session. You do not have to type the database username and password.
One rule: create the database in DirectAdmin first. phpMyAdmin only sees databases and users that DirectAdmin created, because that is when the MySQL user account is actually made on the server. If you open phpMyAdmin before creating any database, you will have nothing to log in to.
Typical jobs you will do in phpMyAdmin: reset a WordPress password by editing the wp_users table, change the site URL in wp_options after a domain change, delete leftover tables from a plugin you removed, or run a search and replace after switching to HTTPS. Take an export before editing anything by hand. There is no undo.
Import and export a database
You have two routes, and both work. The DirectAdmin route is simpler for whole-database backups. On MySQL Management, click Manage next to the database. From there you can download an export of the entire database as a .sql file, and you can upload a backup to import. The import does not ask for credentials, and it offers a choice between keeping the existing data or removing it first, which is what you want when restoring over a broken site.
The phpMyAdmin route gives you more control. Select the database on the left, open the Export tab and click Go for a full .sql download, or pick individual tables. The Import tab accepts .sql and gzipped .sql files up to the upload limit shown on the page. For files larger than that limit, use the DirectAdmin import instead, or send the file to support and we will restore it for you.
- At the old host, export the database as a .sql file (phpMyAdmin Export works almost everywhere).
- In DirectAdmin, create an empty database and user as described above, and note the prefixed names.
- Import the .sql file into the new database through MySQL Management or phpMyAdmin.
- Upload your site files to public_html, then edit the configuration file so it uses the new database name, user and password.
- Load the site. If you see a database connection error, re-check the prefix and the password.
If you are moving a whole site to us, you do not have to do any of this yourself. Our website migration service moves files, databases and email for you. The guide on migrating a website to a new host explains the full sequence if you prefer to do it by hand.
Connecting WordPress: the wp-config.php settings
If you installed WordPress with the app installer in your DirectAdmin account, the database was created and wp-config.php was written for you, and nothing here needs changing. You only edit this file when you upload WordPress manually, restore a copy from another host, or change the database password.
Open File Manager under System Info & Files, go into public_html, and edit wp-config.php. Near the top you will find four lines that matter. Use your full prefixed names and localhost as the host:
- define( 'DB_NAME', 'username_wp' );
- define( 'DB_USER', 'username_wpuser' );
- define( 'DB_PASSWORD', 'the-password-you-copied' );
- define( 'DB_HOST', 'localhost' );
Save the file and reload the site. The message "Error establishing a database connection" means one of those four values is wrong; the password and the missing prefix account for nearly all cases. The $table_prefix line further down is unrelated to the DirectAdmin prefix: it is the prefix WordPress puts on its own table names, and it must match the tables inside the database you imported. For a walkthrough of a fresh install, see how to install WordPress on DirectAdmin.
Managing database users and access
MySQL Management has a MANAGE USERS view that lists every database user on the account, not just the ones attached to a particular database. Click Manage next to a user to change its password or to see its Allowed Hosts. By default a user can connect only from localhost, meaning from scripts running on the same server. That is the correct setting for a website and you should leave it alone.
Allowed Hosts exists for the rare case where a desktop tool or an external server needs to connect to your database directly. You can add a specific IP address there. Avoid adding the % wildcard, which permits connection attempts from anywhere and turns your database password into the only line of defence. The same Manage page for a database includes a Repair button under Database Operations, which is worth trying when WordPress reports a corrupted table after a crash.
Need hosting that just works?
Not sure how many databases you need, or want us to move an existing one? Send us a message on WhatsApp and we will sort it out with you.
Frequently asked questions
Why does my DirectAdmin database name start with my username?
DirectAdmin prefixes every database and database user with your account username and an underscore so that names stay unique on a shared MySQL server. Always use the full prefixed name in wp-config.php and other application settings.
What is the database host for WordPress on DirectAdmin hosting?
Use localhost. The web server and MySQL run on the same machine, so localhost is both the fastest option and the only one permitted by the default Allowed Hosts setting for a database user.
How do I open phpMyAdmin in DirectAdmin?
Go to MySQL Management under Account Manager and click the phpMyAdmin link, or use the phpMyAdmin entry in the main menu. DirectAdmin signs you in automatically, provided you have already created at least one database.
How many MySQL databases can I create on my ProWebHosting plan?
Promotional includes 5 databases, Advanced 15, Professional 25, and Business has no limit. Each database still uses part of your storage allowance.
My .sql file is too large for phpMyAdmin import. What can I do?
Use the import option under Manage on the MySQL Management page, which handles larger files than the phpMyAdmin upload limit. If that still fails, send the file to support and we will import it for you.
I forgot my database password. Can I see it in DirectAdmin?
No, DirectAdmin does not show existing passwords. Open MySQL Management, click MANAGE USERS, then Manage next to the user, and set a new password. Update wp-config.php or your application configuration to match.
Related guides
DirectAdmin tutorials
How to Install WordPress on DirectAdmin: App Installer and Manual Methods
10 min read
DirectAdmin tutorials
DirectAdmin Backup and Restore: How to Back Up Your Website and Bring It Back
8 min read
Hosting basics
How to Migrate a Website to a New Host Without Downtime
9 min read
DirectAdmin tutorials
DirectAdmin File Manager and FTP: Uploading and Managing Your Website Files
8 min read