Create MySQL database in DirectAdmin
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
- Go to Theory7's DirectAdmin login portal
- Enter your username and password
- Click Login
Step 2: Navigate to MySQL Management
- Find Databases or MySQL Management in the menu
- Click on MySQL Databases
- You'll see an overview of existing databases
Step 3: Create new database
- Click Create New Database
- 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:
wordpressbecomesyourusername_wordpress
Password: Generate a strong password
- Use the Random button for a secure password
- Save this password securely!
- 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
- Go to MySQL Management
- Click on the database
- Click Add User
- Enter username and password
- 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
- Go to MySQL Management
- Click on the user
- Enter a new password
- Click Change Password
Using phpMyAdmin
phpMyAdmin is a web interface for database management.
Accessing phpMyAdmin
- Go to MySQL Management in DirectAdmin
- Click phpMyAdmin next to your database
- You'll be automatically logged in
Common actions in phpMyAdmin
Export database (backup):
- Select your database
- Click Export
- Choose Quick for standard export
- Click Go
- Save the
.sqlfile
Import database:
- Select your database
- Click Import
- Choose your
.sqlfile - Click Go
View table:
- Click on a table name
- You'll see the table contents
- 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
localhostas host, not an IP address - Check if MySQL service is active
- Verify your hosting package limits
Creating database backup
Via DirectAdmin
- Go to Backup in DirectAdmin
- Select MySQL Databases
- Choose the databases to backup
- Click Create Backup
Via phpMyAdmin
- Open phpMyAdmin
- Select your database
- Click Export
- Save the file
Automatic backups
Theory7 creates daily automatic backups. Contact support for restore.
Tips for database management
- Regular backups: Make weekly manual backups
- Strong passwords: Use the password generator
- Separate databases: Use a separate database for each website
- Clean up: Remove unused databases
- 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.
0 van 0 vonden dit nuttig