UnderHost
Knowledgebase Docs

How to create and manage MySQL databases in aaPanel

Create and manage MySQL databases in aaPanel on an UnderHost VPS or dedicated server, including users, phpMyAdmin, imports, exports, backups,

On this page

aaPanel manages MySQL databases through the Database section. You can create databases, manage users, access phpMyAdmin, and schedule backups all from within the panel. On UnderHost VPS and dedicated services, database performance also depends on allocated CPU, RAM, disk I/O, and how much memory MySQL is allowed to use.

Create a database

  1. Log in to aaPanel and click Database in the left sidebar
  2. Click Add Database
  3. Fill in the details:
    • Database name: A unique name (lowercase letters, numbers, underscores)
    • Username: A dedicated database user for this database
    • Password: A strong password for the database user
    • Access permissions: Select Local server (most secure)-only applications on the same server can connect
  4. Click Submit

Note the database name, username, password, and host (127.0.0.1 or localhost) for use in your application's configuration file.

Access phpMyAdmin

aaPanel includes phpMyAdmin, accessible from the Database section:

  1. Go to Database
  2. Find the database in the list
  3. Click the phpMyAdmin icon or link next to it

phpMyAdmin opens logged in to that database. From here you can browse tables, run SQL queries, import SQL files, and export backups.

phpMyAdmin must be installed from the App Store

If you do not see phpMyAdmin in aaPanel, it may not be installed. Go to aaPanel → App Store, search for phpMyAdmin, and install it.

Import a database

Via phpMyAdmin (under ~100MB):

  1. Open phpMyAdmin for the target database
  2. Click the Import tab
  3. Select the .sql or .sql.gz file and click Go

Via SSH command line (large databases):

mysql -u DB_USER -p DB_NAME < /path/to/backup.sql

For a compressed backup:

gunzip -c backup.sql.gz | mysql -u DB_USER -p DB_NAME

Export a database

Via phpMyAdmin: Select the database → Export tab → Quick method → Go.

Via SSH (recommended for large databases):

mysqldump -u DB_USER -p DB_NAME | gzip > /www/backup/db-$(date +%Y%m%d).sql.gz

Scheduled database backups

aaPanel can schedule automatic database backups:

  1. Go to Cron Jobs in aaPanel
  2. Click Add task
  3. Set the task type to Backup Database
  4. Select the database, set the backup path, and choose how many backups to retain
  5. Set the schedule (e.g., daily at 3am)
  6. Click Add task

Backup files are stored on the server. Download them via FTP or SFTP periodically to keep an off-server copy.

For production sites, combine aaPanel database backups with off-server storage or an UnderHost backup solution. Always test at least one restore before relying on a backup schedule.

Database connection errors

If your application shows "Error establishing a database connection":

  • Verify the database name, username, and password in wp-config.php or your app's config match exactly what you set in aaPanel
  • Use 127.0.0.1 as the database host (not localhost) if you encounter connection refused errors
  • Check MySQL is running: systemctl status mysql
  • Check disk space is not full: df -h-a full disk stops MySQL
  • Review MySQL error log: tail -50 /www/server/data/mysql-error.log
  • If the issue follows a to UnderHost, compare database name, username, table prefix, and PHP version with the old host

Related: Create website in aaPanel | Install WordPress in aaPanel | cPanel phpMyAdmin | Database connection error

Was this article helpful?

Need aaPanel hosting?

Install aaPanel on an UnderHost VPS or dedicated server when you want a simple web interface for sites, databases, SSL, and apps.

Related articles

Back to aaPanel