How to create a MySQL database

This article explains how to create a MySQL database in cPanel, how to import a .sql file, and how to download a backup copy using phpMyAdmin.

What is it used for?

A database stores a website's dynamic content, such as users, orders, or posts. From cPanel, you can:

  • Create the database, a user, and their permissions.
  • Import a .sql or .sql.zip file into an empty database.
  • Export a copy of the database to your computer.

Access: log in to cPanel from the Client Portal → Log in to cPanel, or at https://yourdomain.com/cpanel. Then go to Databases → MySQL Databases.

Create the database and user

  1. Log in to cPanel.
  2. Open Databases → MySQL Databases.

Bases de datos MySQL en cPanel

  1. Under Create New Database, enter a name and click Create Database.

Crear una nueva base de datos MySQL

  1. Under Current Databases, you will see the full name. cPanel adds your account username as a prefix, for example account_store.

Nombre completo en Bases de datos actuales

  1. Under Add New User, fill in the username and password. You can use cPanel's password generator.
  2. Click Create User.

Añadir un usuario de MySQL

  1. Under Add User to Database, select the user and the database.
  2. Click Add.

Asociar el usuario a la base de datos

  1. Check ALL PRIVILEGES.
  2. Click Make Changes.

Asignar todos los privilegios al usuario

cPanel confirms that the changes have been saved.

Confirmación de privilegios guardados

Important: in your application, use the full database name and username, including the prefix. Creating the database is not enough: the user must be added to that database with permissions saved. To import a file, the database must exist and it is recommended that it be empty.

Import a database

  1. In cPanel, open Databases → phpMyAdmin.

phpMyAdmin en cPanel

  1. In the left column, click the name of the empty database.
  2. Click Import.

Botón Importar en phpMyAdmin

  1. Click Choose File and select the .sql or .sql.zip file from your computer.
  2. Click Go.

Elegir el archivo SQL e importarlo

If the import finishes successfully, phpMyAdmin displays a green message and the tables will appear on the left.

Tablas de la base importada

Download a backup copy

  1. Access phpMyAdmin.
  2. Click the name of the database.
  3. Click Export.

Botón Exportar en phpMyAdmin

  1. Leave the quick method selected and click Go.

Your browser will download a .sql file containing the copy of that database.

Common issues

  • Access denied or the site does not connect: check the full database name and username, including the prefix, and make sure the user has been added to that database with privileges saved.
  • The database does not appear when importing: you must first create it under MySQL Databases. In phpMyAdmin, click that database before clicking Import.
  • The file does not import or stops midway: it often exceeds the maximum file size allowed by phpMyAdmin. Compress it as .sql.zip or split the file. Always import into an empty database.
  • The export does not start: verify that you selected the entire database in the left column and not just a single table, unless you only want to export that specific table.

If you are unable to create the database, the user is not properly linked, or the import fails, open a support ticket from the Client Portal or reach out through our website's live chat.

  • crear base de datos mysql, como crear base de datos myql, como subir una base de datos, permisos en base de datos
  • 20 Users Found This Useful
Was this answer helpful?

Related Articles

How to access a MySQL database remotely (home or work)

This article explains how to enable remote access to MySQL to connect from your computer, or...

MySQL databases

A MySQL database stores information for applications like WordPress, online stores, or forums. In...

Using Perl to access your MySQL database

This document contains information for connecting a Perl script with a hosting MySQL database...

Basic commands in MySQL

This article gathers basic MySQL commands to run in the SQL tab of phpMyAdmin. They are useful...

How to manage MySQL databases

This article explains how to manage a MySQL database with phpMyAdmin from cPanel: searching data,...