UnderHost
Knowledgebase Docs

How to create and manage databases in CloudPanel

Create MySQL/MariaDB databases and users in CloudPanel. Import and export databases with phpMyAdmin or the command line. Manage multiple databases per site.

On this page

CloudPanel manages MySQL/MariaDB databases per site. Each site can have multiple databases. The database server runs on the same VPS, so connections from PHP applications are fast and local.

Create a database

  1. Open the site's database settings

    Log in to CloudPanel, go to Sites, click the site you want to add a database to, then click the Databases tab.

  2. Create a new database

    Click Add Database. Fill in:

    • Database Name: A unique name for the database (lowercase, underscores allowed)
    • Database User Name: The user that will connect to this database
    • Password: A strong password for the database user
  3. Save

    Click Add Database. The database and user are created immediately.

Note the database name, username, password, and host (127.0.0.1 or localhost)-you will need these to configure your application's database connection.

Database host is always localhost for local applications

PHP applications running on the same server connect to MySQL at 127.0.0.1 or localhost. Use this as the database host in wp-config.php or any other configuration file.

Access phpMyAdmin

CloudPanel provides phpMyAdmin per site:

  1. Go to Sites → your site → Databases
  2. Click phpMyAdmin next to the database you want to manage
  3. phpMyAdmin opens logged in to that specific database

From phpMyAdmin you can browse tables, run SQL queries, import SQL files, and export backups.

Import a database

Via phpMyAdmin (files under ~100MB):

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

Via SSH command line (large files):

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

Replace DB_USER and DB_NAME with your database credentials. Enter the password when prompted.

Export a database

Via phpMyAdmin: Select the database, click Export, choose Quick or Custom format, and click Go.

Via SSH command line:

mysqldump -u DB_USER -p DB_NAME > /home/SYSTEM_USER/backup.sql

For compressed export:

mysqldump -u DB_USER -p DB_NAME | gzip > /home/SYSTEM_USER/backup.sql.gz

Remote database access

By default, MySQL on CloudPanel only listens on localhost and is not accessible from outside the server. This is the safest configuration. If you need remote access (e.g., from a local development machine):

  • Open port 3306 in the CloudPanel firewall only for your specific IP address-not for all IPs
  • Grant remote access to the database user in phpMyAdmin or via SQL
  • Alternatively, use an SSH tunnel to connect securely without opening port 3306 publicly
Do not open MySQL port 3306 to all IPs

Opening port 3306 to the internet exposes your database server to brute-force attacks. If you need remote access, restrict it to your specific IP only, or use an SSH tunnel.

Related: How to create a website in CloudPanel | Backups in CloudPanel-files and databases | How to configure the CloudPanel firewall | How to connect to your VPS via SSH

Was this article helpful?

Need CloudPanel on a server?

Use CloudPanel on an UnderHost VPS or dedicated server for fast PHP app and WordPress hosting without a heavy panel stack.

Related articles

Back to CloudPanel