CyberPanel Database Management – Create/Delete/List DB

In this chapter, you will learn

  1. How to create/delete/list databases using CyberPanel?
  2. How to access PhpMyAdmin?

For any web server, databases are crucial as they hold various information and allow websites to access their contents. CyberPanel has made database management very easy with its user-friendly web interface. In this tutorial, you will learn how to manage databases using CyberPanel.

Manage Database using CyberPanel Web Interface

Create Database:

Step 1: Navigate to Databases → Create Database to begin creating a database.
Step 2: Choose the website for which you wish to create a database. Then, enter the Database Name, User Name, and Password.
Step 3: Click the Generate button to create the database.

Delete Database:

To delete a database, follow these steps:

Step 1: Navigate to Databases → Delete Database.
Step 2: Select the Website, then choose the Database name you wish to delete.
Step 3: Click the Delete Database button to confirm the deletion of the database.

List Database:

This feature displays all available databases within a website. To view the list of databases, navigate to Databases → List Database.

PhpMyAdmin

PhpMyAdmin is a free tool used for performing administrative tasks on databases. It grants you superpowers to manipulate MySQL databases as needed.

To access PhpMyAdmin, navigate to Databases → PhpMyAdmin.

Log in with the root account. If, for any reason, you don't know the root account password, recover it using the following steps:

Step 1: Open the Ubuntu Terminal.
Step 2: Execute the following command. It will display the MySQL password.

sudo cat /etc/cyberpanel/mysqlPassword
k7TyhIaNqEwUlr

Manage Database using Command Line Interface (CLI)

You can also manage database using command line interface as follows:

Create Database:

To create database using the CLI, modify the following commands and execute.

sudo cyberpanel createDatabase --databaseWebsite mysite.com --dbName mysite_db --dbUsername user1 --dbPassword Pa01w0rd
{"success": 1, "errorMessage": "None"}

List Databases:

To list all the available database inside a website, execute the following command.

sudo cyberpanel listDatabasesPretty --databaseWebsite mysite.com
+----+---------------+---------------+ | ID | Database Name | Database User | +----+---------------+---------------+ | 1 | mysite_db | user1 | +----+---------------+---------------+

Delete Database

To delete a database using commands, run the following commands in terminal.

sudo cyberpanel deleteDatabase --dbName mysite_db
{"success": 1, "errorMessage": "None"}

Summary

In this tutorial, you learned how to create and manage databases in CyberPanel using both the Web Interface and the Command Line Interface. In the next chapter, you will learn how to create and manage users in CyberPanel.