A MySQL database is essential for dynamic websites like WordPress, Joomla, or web shops. In this guide, we explain how to create and manage a database in DirectAdmin.

What is a MySQL database?

MySQL is a database system that stores and manages data. Websites use databases for:

  • User accounts and passwords
  • Blog posts and page content
  • Product information in web shops
  • Form submissions
  • Settings and configurations

When do you need a database?

  • WordPress: Every WordPress site needs a database
  • Web shops: WooCommerce, Magento, PrestaShop
  • Forums: phpBB, vBulletin
  • CMS systems: Joomla, Drupal
  • Custom applications: PHP applications with data storage

Creating a database

Step 1: Log in to DirectAdmin

  1. Go to Theory7's DirectAdmin login portal
  2. Enter your username and password
  3. Click Login

Step 2: Navigate to MySQL Management

  1. Find Databases or MySQL Management in the menu
  2. Click on MySQL Databases
  3. You'll see an overview of existing databases

Step 3: Create new database

  1. Click Create New Database
  2. Fill in the following fields:

Database name: Choose a clear name

  • Example: wordpress, webshop, blog
  • The full name becomes: yourusername_databasename

Database user: Usually the same as database name

  • Example: wordpress becomes yourusername_wordpress

Password: Generate a strong password

  • Use the Random button for a secure password
  • Save this password securely!
  1. Click Create

Step 4: Note the details

After creation, you'll see an overview. Note:

  • Database host: usually localhost
  • Database name: yourusername_databasename
  • Database user: yourusername_user
  • Password: the password you set

Managing database users

Adding an extra user

  1. Go to MySQL Management
  2. Click on the database
  3. Click Add User
  4. Enter username and password
  5. Click Create

Setting user privileges

By default, a user gets all privileges. You can restrict this:

Privilege Meaning
SELECT Read data
INSERT Add data
UPDATE Modify data
DELETE Remove data
CREATE Create tables
DROP Delete tables
ALL PRIVILEGES All rights

Changing password

  1. Go to MySQL Management
  2. Click on the user
  3. Enter a new password
  4. Click Change Password

Using phpMyAdmin

phpMyAdmin is a web interface for database management.

Accessing phpMyAdmin

  1. Go to MySQL Management in DirectAdmin
  2. Click phpMyAdmin next to your database
  3. You'll be automatically logged in

Common actions in phpMyAdmin

Export database (backup):

  1. Select your database
  2. Click Export
  3. Choose Quick for standard export
  4. Click Go
  5. Save the .sql file

Import database:

  1. Select your database
  2. Click Import
  3. Choose your .sql file
  4. Click Go

View table:

  1. Click on a table name
  2. You'll see the table contents
  3. Click Browse for all rows

Connecting database with WordPress

When installing WordPress, you need the database details:

// wp-config.php settings
define('DB_NAME', 'yourusername_wordpress');
define('DB_USER', 'yourusername_wordpress');
define('DB_PASSWORD', 'yourpassword');
define('DB_HOST', 'localhost');

Common problems

"Access denied" error

  • Check if database user is correct
  • Check the password (watch for spaces)
  • Verify the user has privileges on the database

"Unknown database" error

  • Check the database name for typos
  • Verify the database exists in DirectAdmin
  • Note: the full name including prefix

Database too large for import

  • Use phpMyAdmin for files up to 50MB
  • For larger files: import via SSH
  • Or split the file into smaller parts

Connection failed

  • Use localhost as host, not an IP address
  • Check if MySQL service is active
  • Verify your hosting package limits

Creating database backup

Via DirectAdmin

  1. Go to Backup in DirectAdmin
  2. Select MySQL Databases
  3. Choose the databases to backup
  4. Click Create Backup

Via phpMyAdmin

  1. Open phpMyAdmin
  2. Select your database
  3. Click Export
  4. Save the file

Automatic backups

Theory7 creates daily automatic backups. Contact support for restore.

Tips for database management

  1. Regular backups: Make weekly manual backups
  2. Strong passwords: Use the password generator
  3. Separate databases: Use a separate database for each website
  4. Clean up: Remove unused databases
  5. Use prefix: WordPress uses wp_ prefix, you can customize this

Need help?

We're here for you! Running into issues or have questions? Our support team is happy to help you personally. Drop us a message through the ticket system - we usually respond within a few hours and love helping you find the best solution.