StarDomain

How to Manage Databases (MySQL/phpMyAdmin)

How to Manage Databases (MySQL/phpMyAdmin)

Most web applications (WordPress, Joomla, etc.) require a MySQL database. This guide covers creating, managing, and maintaining databases on {{COMPANY_NAME}} hosting.

Creating a Database in cPanel

Step 1: Create the Database

  1. Log in to cPanel.
  2. Go to Databases > MySQL Databases.
  3. Under Create New Database, enter a name (e.g., `mysite_db`).
  4. Click Create Database.

Step 2: Create a Database User

  1. Under Add New User, enter a username and password.
  2. Click Create User.

Step 3: Add User to Database

  1. Under Add User To Database, select the user and database.
  2. Click Add.
  3. On the privileges page, check ALL PRIVILEGES.
  4. Click Make Changes.

[screenshot: cPanel MySQL Database creation page]

Creating a Database in DirectAdmin

  1. Go to MySQL Management (or Databases).
  2. Click Create New Database.
  3. Enter database name, username, and password.
  4. Click Create.

DirectAdmin creates the database and user in one step.

Using phpMyAdmin

phpMyAdmin is a web-based tool for managing MySQL databases.

Accessing phpMyAdmin

  • cPanel: Go to Databases > phpMyAdmin.
  • DirectAdmin: Go to MySQL Management > phpMyAdmin link.

Common Tasks

#### Browse Tables

  1. In phpMyAdmin, click the database name in the left panel.
  2. Click a table name to see its contents.
  3. Use Browse to view data rows.

#### Run SQL Queries

  1. Click the SQL tab.
  2. Enter your query (e.g., `SELECT * FROM users WHERE active = 1`).
  3. Click Go.

#### Import a Database

  1. Click the database name.
  2. Click the Import tab.
  3. Click Choose File and select your `.sql` file.
  4. Click Go.

Tip: Maximum import file size is limited by PHP settings. For large databases, use SSH and the `mysql` command line tool.

#### Export (Backup) a Database

  1. Click the database name.
  2. Click the Export tab.
  3. Select Quick export method and SQL format.
  4. Click Go.
  5. Save the downloaded `.sql` file.

Database Best Practices

  1. Regular backups — export your database weekly.
  2. Strong passwords — use unique passwords for database users.
  3. Limit privileges — only grant necessary permissions.
  4. Optimise tables — use phpMyAdmin > select all tables > Optimise.
  5. Clean up — remove unused databases and users.

Warning: Accidental deletion of a database is irreversible unless you have a backup. Always export before making major changes.


Need help? Contact our support team at {{SUPPORT_URL}}/client/support.