Categories: PHP MySQL

How to Create a MySQL Database in DirectAdmin

To create mysql database directadmin users, open your hosting panel, go to MySQL Management and create the database and its user together. This guide also shows how to open phpMyAdmin, import a .sql backup, handle a file that is too large and connect WordPress with the correct values.

What you need before starting

You need an active DirectAdmin hosting account, the panel login details, a database name you can recognise, a strong database-user password and the application you want to connect. For a normal WordPress installation, you do not need to create a database manually when Softaculous does it for you; use these steps for a manual install, a migration or another PHP application.

Open the HostKarle panel at panel.hostkarle.in. The supplied screenshot shows the login screen; after signing in, the menu names below refer to the user-level DirectAdmin interface.

Sign in to the HostKarle DirectAdmin panel before opening MySQL Management.

Keep a private note of the final database name, database username and password. DirectAdmin may add your account prefix to the name you type, so always copy the complete values shown after creation. Do not use your DirectAdmin password as the database password.

Step 1: Create the MySQL database and user

Why this matters: an application needs both a database to store its tables and a user that has permission to read and change that database.

  1. Sign in to DirectAdmin and open Account Manager.
  2. Select MySQL Management. In some DirectAdmin skins, this is shown under Databases.
  3. Select Create New Database or Create Database.
  4. Choose the quick creation form if it is offered. If you see an Advanced option, use it when you want to set a different database name and username.
  5. Enter a short database name, such as shop, and a separate database username, such as shopuser.
  6. Enter a long, unique password. Save it in your password manager.
  7. Select Create or Save.

DirectAdmin usually displays a success message with the complete database name and username. For example, the panel may turn shop into account_shop and shopuser into account_shopuser. The prefix is part of the credential, so do not remove it when you later edit wp-config.php or another application configuration file.

Success looks like this: the new database appears in MySQL Management, the user is attached to it, and the page gives you a database name, username and password to use in your application.

If the database appears but no user is attached, open the database entry and use its option to create or attach a database user. The user must have access to the database before phpMyAdmin or your application can use it. DirectAdmin’s own documentation also advises creating the database through DirectAdmin before trying to log in to phpMyAdmin. Read the DirectAdmin phpMyAdmin documentation for the panel’s current one-click login behaviour.

Step 2: Open phpMyAdmin from DirectAdmin

Why this matters: phpMyAdmin lets you inspect tables and import SQL through a browser without typing database commands.

  1. Return to Account Manager → MySQL Management.
  2. Find the database you just created.
  3. Select its phpMyAdmin icon or Login link. Some skins show phpMyAdmin as a main menu item instead; open it from the DirectAdmin dashboard and select the database.
  4. If DirectAdmin uses one-click login, phpMyAdmin opens without asking for the database password.
  5. If a login form appears, use the complete database username and its database password. Do not use your DirectAdmin panel username unless the panel specifically tells you to.

Success looks like this: phpMyAdmin opens and the left sidebar shows the database you created. Select that database before importing or changing anything.

The database name and user are not the same thing. The database is the container for tables; the user is the credential that receives permission to work inside it. Keeping those values separate makes migrations and troubleshooting easier.

Step 3: Import a .sql file in phpMyAdmin

Why this matters: an SQL dump contains the table structure and data from an existing site or application.

Before importing, make sure the destination database is empty or that you understand what the dump will change. A WordPress dump can contain tables with a prefix such as wp_, but it may use a different prefix on the old host.

  1. In phpMyAdmin, select the destination database in the left sidebar.
  2. Open the Import tab.
  3. Under File to import, choose your .sql file. A compressed .sql.gz file is often useful when the uncompressed dump is large.
  4. Leave Format set to SQL unless your export uses another format.
  5. Check the file name and target database one more time.
  6. Select Import or Go at the bottom of the page.

When the import finishes, phpMyAdmin should display a success message and the left sidebar should list the imported tables. Open one table and check that it contains rows. For WordPress, seeing tables such as wp_options, wp_posts and wp_users is a useful first check, although your table prefix may be different.

If the import stops with an SQL error, note the first error message and the table named in it. Importing the same dump repeatedly into a partly filled database can create confusing duplicate-table errors, so restore a clean database or remove only the test tables before trying again.

Step 4: Handle a large database import

Why this matters: browser uploads are controlled by PHP and web-server request limits, so a large file can fail before MySQL reads it.

There is no single “DirectAdmin import limit” that applies to every server. The visible limit can depend on upload_max_filesize, post_max_size, execution time and the hosting account’s own limits. DirectAdmin documents the relationship between those PHP settings in its guide to increasing the PHP upload size.

Try these options in order:

  1. Export the database again and select compression. A compressed .sql.gz file is normally much smaller than the raw SQL file.
  2. Export only the tables you need if the old application contains unused tables, logs or cache data.
  3. Upload the compressed dump through phpMyAdmin and wait for the success message instead of refreshing during the import.
  4. If the browser still rejects the file, contact the hosting provider with the database size and the exact error. On shared hosting, PHP and web-server settings are controlled at the server level; do not edit a server-wide php.ini or run administrator commands from a normal hosting account.
  5. If you have authorised SSH access on a server you administer, a command-line import can avoid the browser upload step:
mysql -u 'account_dbuser' -p 'account_database' < backup.sql

Enter the database-user password when prompted. Use the database host supplied by your provider if it is not localhost. Do not put the password directly in the command because it can be exposed in shell history or process listings.

Success looks like this: the import completes without a timeout, phpMyAdmin lists the expected tables and the application can read them after its configuration is updated.

Step 5: Connect WordPress to the database

Why this matters: WordPress cannot load posts, settings or users until wp-config.php points to the new database with the correct credentials.

Edit wp-config.php in the WordPress document root and check these values:

define( 'DB_NAME', 'account_database' );
define( 'DB_USER', 'account_dbuser' );
define( 'DB_PASSWORD', 'use-the-database-password' );
define( 'DB_HOST', 'localhost' );
define( 'DB_CHARSET', 'utf8mb4' );
define( 'DB_COLLATE', '' );

Replace the examples with the exact values displayed by DirectAdmin. localhost is the usual host for a database running with the same hosting account, but use a different host only when HostKarle or your application instructions provide one.

If you are moving WordPress, import the old database first, copy the WordPress files, then update these values. If the domain name is changing too, that is a separate URL-replacement task; do not run a blind search-and-replace on a database because serialised WordPress data can be damaged. For a new installation, see how to install WordPress in DirectAdmin with Softaculous.

Success looks like this: the site loads without “Error establishing a database connection”, the WordPress dashboard opens and existing posts and settings are visible. If the site was moved, test both the home page and /wp-admin/ before deleting the old copy.

Step 6: Verify permissions and clean up

Why this matters: a working login is not enough if the application is connected to the wrong database or if old credentials remain exposed.

Use this short checklist:

  1. In phpMyAdmin, confirm the expected table count and check one or two tables for real data.
  2. In the application, load a page that reads from the database and perform one safe write, such as saving a draft.
  3. Confirm that the database user is attached to the intended database in DirectAdmin.
  4. Remove temporary SQL files from public web folders and from any shared download directory.
  5. Keep the database password in your password manager and do not leave it in screenshots, tickets or public repositories.
  6. Take a fresh backup using the self-service tools available in your hosting account before making further migration changes.

For a WordPress password problem after a migration, use the separate guide on resetting a WordPress password from phpMyAdmin. It is safer to confirm the database connection first; otherwise a password change can hide the real configuration problem.

Troubleshooting common DirectAdmin database errors

“Cannot create another database”

The hosting plan may have reached its database allowance. Check the usage and limit shown in MySQL Management, remove only databases you no longer need, or move to a plan with the required database capacity. Never delete a live database without a verified backup.

phpMyAdmin says access denied

Check the complete database username, including any account prefix, and reset the database-user password in DirectAdmin if necessary. Make sure you created the database through DirectAdmin and are not trying to use a panel password or an old host’s credentials.

The SQL file is rejected or times out

Compress the dump, reduce the export to the required tables or ask for a server-side import. Record whether the error says the upload is too large, the request timed out or the SQL statement failed; each points to a different fix.

WordPress still shows a database connection error

Compare all four important values in wp-config.php: database name, username, password and host. A missing account prefix is a common migration mistake. Also check that the imported database belongs to the same site and that the database user is attached to it in DirectAdmin.

FAQ

Can I create a MySQL database in DirectAdmin without phpMyAdmin?

Yes. Create the database and user in MySQL Management first; phpMyAdmin is only the browser tool you use afterwards to inspect or import data. Your application can connect directly using the four database values in its configuration.

What is the database host in DirectAdmin?

For an application hosted on the same account, localhost is commonly used. Use the host value shown by your provider or application setup if it gives you a different value; do not guess when a connection error persists.

How do I import a database larger than the phpMyAdmin limit?

Create a compressed dump, export fewer tables or request a server-side import. The exact limit depends on PHP upload and post-size settings and may also depend on the hosting account, so the file size shown by phpMyAdmin is the useful starting point.

Should the database name and username be identical?

No. DirectAdmin may offer a quick form that creates matching names, but an advanced form can let you use different names. Whichever values you choose, copy the complete names shown by the panel into your application configuration.

Can I delete the old database after migration?

Only after the new site works, the imported tables are verified and you have a separate backup. Keep the old database until you have tested the public site, admin login and any forms or orders that write new data.

Samrat Ghosh

Samrat Ghosh writes hands-on guides about web hosting, WordPress, domains and email for Indian small businesses, students and freelancers - the practical documentation he wishes had existed when he set up his first website.

Share
Published by
Samrat Ghosh

Recent Posts

Zoho Mail Alternatives for Indian Businesses (2026)

Compare zoho mail alternatives for Indian businesses by rupee cost, IMAP access and mailbox limits,…

3 hours ago

Best Wix Alternatives in India for Small Businesses

Compare Wix alternatives for Indian small businesses: see 3-year rupee costs, WordPress hosting, migration limits,…

14 hours ago

Titan Email Price in India: Cost per Mailbox Explained

Titan email price in India explained with mailbox costs, features, team totals and a comparison…

20 hours ago

HostKarle vs Bluehost India: Price, Renewal and Panel

HostKarle vs Bluehost compares Indian shared hosting prices, renewal bills, email, SSL, backups, panels and…

1 day ago

Hindi Blog Kaise Banaye: WordPress Step-by-Step Guide

Learn how to write blog in hindi with WordPress, Hindi typing tools, domain and hosting…

2 days ago

Google Workspace Alternatives in India for Small Teams

Compare Google Workspace alternatives in India by yearly rupee cost, email features and migration effort…

2 days ago

This website uses cookies.