A MySQL database is essential for dynamic websites such as WordPress, Joomla, or online 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 online shops
  • Form submissions
  • Settings and configurations

When Do You Need a Database?

  • WordPress: Every WordPress site needs a database
  • Online 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 the Theory7 DirectAdmin login portal
  2. Enter your username and password
  3. Click on Log in

Step 2: Navigate to MySQL Management

  1. Look for Databases or MySQL Management in the menu
  2. Click on MySQL Databases
  3. You will see an overview of existing databases

Step 3: Create a New Database

  1. Click on Create New Database or Create Database
  2. Fill in the following fields:
    • Database name: Choose a clear name
      Example: `wordpress`, `webshop`, `blog`
      The full name will be: `yourusername_databasename`
    • Database user: Usually the same as the database name
      Example: `wordpress` becomes `yourusername_wordpress`
    • Password: Generate a strong password
      Use the Random button for a secure password
      Store this password safely!
  3. Click on Create or Create

Step 4: Note the Details

After creation, you will 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 on Add User or Add User
  4. Fill in username and password
  5. Click on Create

Setting User Permissions

By default, a user gets all permissions. You can limit this:

Permission Meaning
SELECT Read data
INSERT Add data
UPDATE Modify data
DELETE Delete data
CREATE Create tables
DROP Delete tables
ALL PRIVILEGES All permissions

Changing Password

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

Using phpMyAdmin

phpMyAdmin is a web interface for database management.

Accessing phpMyAdmin

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

Common Actions in phpMyAdmin

Exporting Database (Backup):

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

Importing Database:

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

Viewing Table:

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

Connecting Database with WordPress

During WordPress installation, you will 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 Issues

"Access Denied" Error Message

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

"Unknown Database" Error Message

  • Check the database name for typos
  • Verify that 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 the MySQL service is active
  • Verify your hosting package limits

Creating a Database Backup

Via DirectAdmin

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

Via phpMyAdmin

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

Automatic Backups

Theory7 makes daily automatic backups. Contact support for restore.

Tips for Database Management

  1. Regular Backups: Make a manual backup weekly
  2. Strong Passwords: Use the password generator
  3. Separate Databases: Use a separate database for each website
  4. Cleanup: Remove unused databases
  5. Use Prefix: WordPress uses `wp_` prefix, which you can change

Need Help?

We are here for you! Are you facing any issues or have questions? Our support team is happy to assist you personally. Send us a message via the ticket system - we usually respond within a few hours and are happy to help.